/* /app/ (T-069): what /call/call.css (linked first — colours, cards, buttons, the call screen) does not have.
   A file, not inline: the page's CSP is style-src 'self' (web/conf/default.conf). */

:root { --tonal: #e3eefc; --on-tonal: #1a5fb4; --warn: #8a5a00; }
@media (prefers-color-scheme: dark) { :root { --tonal: #1b2a3f; --on-tonal: #9cc4ff; --warn: #f0c060; } }

.card.profile { text-align: left; padding-top: 5vh; max-width: 460px; }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.head .who { font-size: 22px; }
.btn.small { width: auto; padding: 8px 14px; margin: 0; font-size: 14px; flex: none; }
.btn.tonal { background: var(--tonal); color: var(--on-tonal); }
.gap { margin-top: 12px; }
.row { display: flex; gap: 8px; }
.row .btn { margin: 0; }

.conn { font-size: 14px; margin: 4px 0 16px; color: var(--muted); }
.conn::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px;
                background: var(--muted); vertical-align: 1px; }
.conn[data-state="online"]::before { background: var(--ok); }

.panel { background: var(--card); border-radius: 16px; padding: 16px; margin: 0 0 16px; }
.panel .label { margin-bottom: 8px; }
.link-line { margin: 0 0 12px; font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.link-line a { color: var(--accent); text-decoration: none; }
.qr { width: 196px; max-width: 70%; margin: 16px auto 0; }
.qr svg { display: block; width: 100%; height: auto; border-radius: 8px; }

.note.ok { color: var(--ok); }
.note.warn { color: var(--warn); margin-top: 20px; }
#sso-buttons .btn { margin-top: 8px; }
#password-form { margin-top: 8px; }
.card .label.gap { margin-top: 12px; }

/* --- incoming call: dark, like a phone's (the screen itself is in /call/call.css since T-071 — the guest has it too) - */
.in-mxid { color: #a1a1a6; margin: 0 0 8px; font-size: 14px; overflow-wrap: anywhere; }

.call-note { color: #c7c7cc; font-size: 14px; max-width: 360px; margin: 12px auto 0; }

/* --- T-070: group calls — the panel over the call (add / people / link) ----------------------------------------- */
/* The call screen is dark in both themes; the panel too (its own colour tokens for the shared .input/.btn/.hint). */
.sheet { position: absolute; inset: 0; z-index: 5; display: flex; align-items: flex-end; justify-content: center;
         background: rgba(0, 0, 0, .55); }
.sheet-card { --fg: #f2f2f2; --muted: #a1a1a6; --card: #2c2c2e; --line: #3a3a3c; --tonal: #1b2a3f; --on-tonal: #9cc4ff;
              width: 100%; max-width: 460px; max-height: 80%; overflow-y: auto; padding: 16px 16px max(20px, env(safe-area-inset-bottom));
              border-radius: 18px 18px 0 0; background: #1c1c1e; color: var(--fg); }
@media (min-width: 700px) { .sheet { align-items: center; } .sheet-card { border-radius: 18px; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sheet-title { font-size: 18px; margin: 0; }
.sheet .link-line a { color: #4c9bff; }
.sheet .text { margin-top: 0; }
.people { list-style: none; margin: 0; padding: 0; }
.person { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.person:last-child { border-bottom: 0; }
.person-avatar { width: 32px; height: 32px; flex: none; border-radius: 50%; display: flex; align-items: center;
                 justify-content: center; font-weight: 600; background: var(--accent); color: var(--on-accent); }
.person.speaking .person-avatar { box-shadow: 0 0 0 2px var(--ok); }
.person-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-sub { color: var(--muted); font-size: 13px; flex: none; }
.controls { flex-wrap: wrap; }
/* Up to seven round buttons on a phone (mic, camera, flip, add, people, link, hang up): smaller on narrow screens. */
@media (max-width: 480px) {
  .controls { gap: 6px; padding-left: 6px; padding-right: 6px; }
  .controls .round { width: 44px; height: 44px; }
  .controls .round svg { width: 22px; height: 22px; }
}

/* --- T-076: chats — the list beside the conversation (a computer), or one of them at a time (a phone) ------------ */
:root { --bubble-mine: #d9e9ff; --bubble-theirs: #f0f0f3; --sel: #e8f0fc; }
@media (prefers-color-scheme: dark) { :root { --bubble-mine: #1d3a5f; --bubble-theirs: #26262a; --sel: #1b2a3f; } }

.home { position: fixed; inset: 0; display: flex; background: var(--bg); }
.list-pane { width: 360px; flex: none; display: flex; flex-direction: column; border-right: 1px solid var(--line); min-height: 0; }
.main-pane { flex: 1; min-width: 0; position: relative; overflow-y: auto; }
.back-link, .conv-head .conv-back { display: none; }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
             padding: max(12px, env(safe-area-inset-top)) 16px 8px; }
.list-title { font-size: 24px; margin: 0; }
.me-btn { border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%; }
.me-avatar, .chat-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; display: flex; align-items: center;
                           justify-content: center; font-weight: 600; color: var(--on-accent); background: var(--accent);
                           overflow: hidden; user-select: none; }
.chat-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.list-conn { margin: 0 16px 8px; }
.list-enable { width: auto; margin: 0 16px 8px; padding: 10px 14px; font-size: 15px; }
.chat-list { list-style: none; margin: 0; padding: 0 0 16px; overflow-y: auto; flex: 1; min-height: 0; }
.chat-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; border: 0; background: none;
            color: inherit; font: inherit; text-align: left; cursor: pointer; }
.chat-row:hover { background: var(--card); }
.chat-row.selected { background: var(--sel); }
.chat-row .chat-avatar { width: 48px; height: 48px; font-size: 20px; }
.chat-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-top, .chat-bottom { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.chat-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-time { flex: none; font-size: 13px; color: var(--muted); }
.chat-preview { flex: 1; min-width: 0; color: var(--muted); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-badge { flex: none; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--accent);
              color: var(--on-accent); font-size: 13px; font-weight: 600; line-height: 22px; text-align: center; }
li.unread .chat-time { color: var(--accent); font-weight: 600; }
li.unread .chat-preview { color: var(--fg); }
.chats-empty { padding: 8px 16px; color: var(--muted); }
.chats-empty .btn { width: auto; }

/* the conversation */
.conv { position: absolute; inset: 0; display: flex; flex-direction: column; }
.conv-head { display: flex; align-items: center; gap: 10px; padding: max(8px, env(safe-area-inset-top)) 12px 8px;
             border-bottom: 1px solid var(--line); background: var(--bg); }
.conv-title { flex: 1; min-width: 0; }
.conv-name { margin: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-sub { margin: 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; padding: 0; cursor: pointer;
            display: flex; align-items: center; justify-content: center; background: none; color: var(--accent); }
.icon-btn:hover { background: var(--card); }
.icon-btn:disabled { opacity: .4; cursor: default; }
.icon-btn svg { width: 24px; height: 24px; fill: currentColor; }
.icon-btn svg .stroke { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.send { background: var(--accent); color: var(--on-accent); }
.icon-btn.send:hover { background: var(--accent); filter: brightness(1.08); }
.icon-btn.send svg { width: 20px; height: 20px; }

.conv-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 12px 12px; overscroll-behavior: contain; }
.conv-start { color: var(--muted); font-size: 13px; text-align: center; max-width: 420px; margin: 8px auto 12px; }
.conv-more { display: block; margin: 4px auto 8px; font-size: 14px; }
.msgs { list-style: none; margin: 0 auto; padding: 0; max-width: 760px; display: flex; flex-direction: column; gap: 4px; }
.day, .event { text-align: center; margin: 10px 0 6px; }
.day span, .event span { display: inline-block; font-size: 13px; color: var(--muted); background: var(--card);
                         border-radius: 999px; padding: 2px 12px; }
.msg { display: flex; }
.msg.mine { justify-content: flex-end; }
/* T-091: the bubble sits in a column with its reaction chips and thread summary under it. */
.msg { position: relative; align-items: flex-start; }
.msg-col { max-width: min(78%, 520px); min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.msg.mine .msg-col { align-items: flex-end; }
.bubble { max-width: 100%; padding: 6px 10px 4px; border-radius: 16px; background: var(--bubble-theirs);
          overflow-wrap: anywhere; }
.msg.mine .bubble { background: var(--bubble-mine); border-bottom-right-radius: 6px; }
.msg.theirs .bubble { border-bottom-left-radius: 6px; }
.bubble.muted-bubble { background: transparent; border: 1px dashed var(--line); }
.bubble.pending { opacity: .7; }
.msg-sender { margin: 0 0 2px; font-size: 13px; font-weight: 600; color: var(--accent); }
.msg-text { margin: 0; white-space: pre-wrap; }
.muted-text { color: var(--muted); font-style: italic; font-size: 15px; }
.msg-quote { border-left: 3px solid var(--accent); padding: 2px 8px; margin: 2px 0 4px; font-size: 14px; display: flex;
             flex-direction: column; }
.quote-who { color: var(--accent); font-weight: 600; font-size: 13px; }
.quote-text { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-meta { margin: 2px 0 0; display: flex; justify-content: flex-end; align-items: center; gap: 6px; font-size: 12px;
            color: var(--muted); }
.msg-tick { letter-spacing: -3px; padding-right: 3px; }
.msg-tick.read { color: var(--accent); }
.msg-failed { color: var(--danger); }
.small-link { font-size: 12px; }
.bubble a { color: var(--accent); }

.media { margin: 2px 0; }
.media-image { margin: -2px -6px 0; }
.pic-link { display: block; }
.pic, .pic-placeholder svg { display: block; max-width: 100%; height: auto; border-radius: 12px; }
.pic-placeholder svg { background: var(--line); }
.pic-placeholder { min-width: 120px; min-height: 80px; border-radius: 12px; background: var(--line); }
.pic-placeholder:has(svg) { min-width: 0; min-height: 0; background: none; }
.media.loading { opacity: .6; }
.media-btn { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 8px 14px 8px 10px;
             background: var(--tonal); color: var(--on-tonal); font: inherit; font-weight: 600; cursor: pointer; }
.media-btn:disabled { opacity: .6; cursor: default; }
.media-btn svg { width: 20px; height: 20px; fill: currentColor; }
.voice { display: block; width: 260px; max-width: 100%; height: 40px; }
.clip { display: block; max-width: 100%; height: auto; border-radius: 12px; background: #000; }
.file-row { display: flex; align-items: center; gap: 10px; }
.file-info { flex: 1; min-width: 0; }
.file-name { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.file-size { margin: 0; font-size: 13px; color: var(--muted); }
.file-row .btn.small { margin: 0; }
.media-err { font-size: 14px; }

.conv-err { margin: 0; padding: 4px 16px; }
.composer { display: flex; align-items: flex-end; gap: 6px; margin: 0; padding: 8px 8px max(8px, env(safe-area-inset-bottom));
            border-top: 1px solid var(--line); background: var(--bg); }
.conv-input { flex: 1; min-width: 0; resize: none; padding: 9px 14px; border-radius: 20px; line-height: 1.4; max-height: 40vh; }
.rec { flex: 1; align-self: center; color: var(--danger); font-weight: 600; font-variant-numeric: tabular-nums; }
.rec::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--danger);
               margin-right: 8px; vertical-align: 0; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .rec::before { animation: none; } }

/* A phone: one pane at a time — the list, or (show-main) the conversation / the profile with a way back. */
@media (max-width: 767px) {
  .list-pane { width: 100%; border-right: 0; }
  .main-pane { display: none; }
  .home.show-main .list-pane { display: none; }
  .home.show-main .main-pane { display: block; }
  .back-link { display: inline-block; margin-bottom: 12px; }
  .conv-head .conv-back { display: flex; }
  .card.profile { padding-top: max(16px, env(safe-area-inset-top)); }
  .msg-col { max-width: 85%; }
}

/* --- T-071: the list pane's two tabs — chats and recent calls ---------------------------------------------------- */
.tabs { display: flex; gap: 4px; margin: 0; font-size: inherit; }
.tab { position: relative; border: 0; background: none; padding: 6px 12px; border-radius: 999px; font: inherit; font-size: 20px;
       font-weight: 700; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.tab[aria-selected="true"] { color: var(--fg); background: var(--card); }
.tab-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--on-accent);
             font-size: 12px; font-weight: 600; line-height: 20px; text-align: center; }
.tab-badge.missed { background: var(--danger); color: #fff; }
.list-pane.tab-calls #chat-list, .list-pane.tab-calls #chats-empty { display: none; }
.list-pane:not(.tab-calls) #call-list, .list-pane:not(.tab-calls) #calls-empty { display: none; }
/* T-102: "Create a call link" heads the calls tab only. */
.list-link-new { width: auto; margin: 4px 16px 8px; padding: 10px 14px; font-size: 15px; }
.list-pane:not(.tab-calls) #list-link-new { display: none; }
.call-list .cl-row:hover { background: var(--card); }
@media (max-width: 380px) { .tab { font-size: 17px; padding: 6px 9px; } }

/* --- T-078: the lounge — the "Online now" strip, its row, banner, the person card and dialogs, video notes ------- */
:root { --away: #f5a623; --lounge-bg: #eef5ff; }
@media (prefers-color-scheme: dark) { :root { --away: #e0a030; --lounge-bg: #15243a; } }

.online { padding: 2px 0 6px; border-bottom: 1px solid var(--line); flex: none; }
.online-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 16px; }
.online-title { margin: 0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.online-count { color: var(--ok); }
.online-all { font-size: 14px; padding: 4px 0; }
.strip { list-style: none; margin: 0; padding: 6px 12px 2px; display: flex; gap: 4px; overflow-x: auto; overscroll-behavior-x: contain;
         scrollbar-width: none; scroll-snap-type: x proximity; }
.strip::-webkit-scrollbar { display: none; }
.strip li { flex: none; scroll-snap-align: start; }
.face { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 64px; padding: 4px 0; border: 0;
        background: none; color: inherit; font: inherit; cursor: pointer; border-radius: 12px; }
.face:hover { background: var(--card); }
.face:focus-visible, .msg-av:focus-visible, .msg-sender:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.face-pic { position: relative; display: block; flex: none; }
.face .chat-avatar { width: 52px; height: 52px; font-size: 20px; }
.face-name { max-width: 60px; font-size: 12px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip.compact { padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--bg); flex: none; }
.strip.compact .face { width: auto; padding: 2px; }
.strip.compact .face .chat-avatar { width: 36px; height: 36px; font-size: 15px; }
/* The presence dot: green — online, amber — the tab is open but idle; none — seen within the hour. */
.pres-dot { position: absolute; right: 0; bottom: 0; width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid var(--bg);
            background: transparent; display: none; }
.pres-dot.active, .pres-dot.online { display: block; background: var(--ok); }
.pres-dot.away { display: block; background: var(--away); }
.strip.compact .pres-dot { width: 11px; height: 11px; border-width: 2px; }
.pres-dot.big { width: 20px; height: 20px; border-width: 3px; right: 4px; bottom: 4px; }
.strip-empty { padding: 6px 16px 4px; display: flex; align-items: center; gap: 12px; }
.strip-empty-text { margin: 0; flex: 1; font-size: 14px; color: var(--muted); }
.strip-empty .btn.small { flex: none; }

.chat-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); align-self: center; }
li.lounge .chat-row { background: var(--lounge-bg); }
li.lounge .chat-row.selected { background: var(--sel); }
.lounge-join { border-bottom: 1px solid var(--line); flex: none; }
.lounge-join .chat-avatar svg { width: 26px; height: 26px; fill: currentColor; }
.lounge-join .chat-name { color: var(--accent); }
.lounge-join:disabled { opacity: .7; cursor: default; }

.lounge-banner { display: flex; align-items: center; gap: 8px; margin: 0; padding: 4px 6px 4px 14px; font-size: 13px; color: var(--muted);
                 background: var(--card); border-bottom: 1px solid var(--line); flex: none; }
.lounge-banner > svg { width: 16px; height: 16px; flex: none; fill: currentColor; }
.lounge-banner > svg .stroke { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.lounge-banner-text { flex: 1; min-width: 0; }
.lounge-banner a { color: var(--accent); }
.icon-btn.small-icon { width: 30px; height: 30px; color: var(--muted); }
.icon-btn.small-icon svg { width: 16px; height: 16px; }

/* Group messages: the avatar of a run, and the name — both open the card. */
.msg.in-group { gap: 6px; align-items: flex-start; }
.msg-av { width: 32px; height: 32px; flex: none; font-size: 14px; border: 0; padding: 0; cursor: pointer; margin-top: 2px; }
.msg-av.spacer { background: none; cursor: default; }
button.msg-sender { display: block; border: 0; padding: 0; margin: 0 0 2px; background: none; font: inherit; font-size: 13px; font-weight: 600;
                    color: var(--accent); cursor: pointer; text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
                    white-space: nowrap; }
button.msg-sender:hover { text-decoration: underline; }

/* Video notes: a circle, no bubble — in every chat. */
.bubble.bare { background: none !important; padding: 0; border: 0; }
.bubble.bare .msg-meta { padding: 0 6px; }
.bubble.bare .msg-sender { padding: 0 6px; }
.vnote-circle { position: relative; display: block; width: 220px; height: 220px; padding: 0; border: 0; border-radius: 50%; overflow: hidden;
                background: #1c1c1e; cursor: pointer; color: #fff; }
.vnote-thumb, .vnote-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.vnote-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); pointer-events: none; }
.vnote-ring circle { fill: none; stroke-width: 3; }
.vnote-ring .ring-fg { stroke: #fff; }
.rec-ring .ring-fg { stroke: var(--danger); }
.vnote-ring .ring-bg { stroke: rgba(255, 255, 255, .25); }
.vnote-play { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%;
              background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; }
.vnote-play svg { width: 28px; height: 28px; fill: #fff; margin-left: 3px; }
.vnote-circle.playing .vnote-play { display: none; }
.vnote-dur { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); font-size: 12px; font-weight: 600;
             padding: 1px 8px; border-radius: 999px; background: rgba(0, 0, 0, .5); font-variant-numeric: tabular-nums; }
.vnote.loading .vnote-circle { opacity: .7; }

/* Recording a video note: the round preview over the conversation. */
.vnote-rec { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center;
             gap: 12px; padding: 16px; background: rgba(0, 0, 0, .78); color: #fff; }
.vnote-stage { position: relative; width: min(280px, 72vw); height: min(280px, 72vw); }
.vnote-canvas { display: block; width: 100%; height: 100%; border-radius: 50%; background: #000; transform: scaleX(-1); }
.vnote-rec .vnote-ring { inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); }
.vnote-time { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.vnote-actions { width: min(320px, 90vw); }
.vnote-actions .btn { flex: 1; }

/* @mentions */
.mentions { list-style: none; margin: 0; padding: 4px 0; max-height: 220px; overflow-y: auto; border-top: 1px solid var(--line);
            background: var(--bg); flex: none; }
.mentions .chat-row { padding: 6px 16px; }
.mentions .chat-row .chat-avatar { width: 32px; height: 32px; font-size: 14px; }
.mentions .chat-row[aria-selected="true"] { background: var(--sel); }

/* Dialogs: a card in the middle on a computer, a bottom sheet on a phone. */
.dlg { padding: 0; border: 0; background: transparent; color: var(--fg); max-width: 100vw; max-height: 100vh; overflow: visible; }
.dlg::backdrop { background: rgba(0, 0, 0, .45); }
.dlg-card { position: relative; width: min(400px, calc(100vw - 32px)); max-height: min(640px, calc(100vh - 48px)); overflow-y: auto;
            padding: 20px; border-radius: 18px; background: var(--bg); box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
@media (prefers-color-scheme: dark) { .dlg-card { background: #1c1c1e; --card: #2c2c2e; --bg: #1c1c1e; } }
.dlg.tall .dlg-card { height: min(640px, calc(100vh - 48px)); display: flex; flex-direction: column; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dlg-title { margin: 0; font-size: 19px; }
.dlg-x { position: absolute; top: 10px; right: 10px; color: var(--muted); }
.dlg .text { margin: 0 0 12px; }
.dlg .choices { border: 0; padding: 0; margin: 12px 0 16px; }
.dlg .choices .check { margin-bottom: 10px; }
.dlg .choices legend { margin-bottom: 8px; padding: 0; }
.people-all { flex: 1; margin-top: 8px; padding-bottom: 0; }
.person-row { padding: 8px 4px; border-radius: 12px; }
.person-row .chat-avatar { width: 44px; height: 44px; font-size: 18px; }
.chat-preview.is-online { color: var(--ok); }
.person-hero { position: relative; width: 104px; height: 104px; margin: 8px auto 12px; }
.big-avatar { width: 104px; height: 104px; font-size: 42px; }
.person-title { margin: 0; text-align: center; font-size: 22px; overflow-wrap: anywhere; }
.person-title.small-title { font-size: 18px; text-align: left; margin-bottom: 4px; padding-right: 36px; }
.person-mxid { text-align: center; }
.person-seen { text-align: center; margin: 0 0 16px; color: var(--muted); font-size: 15px; }
.person-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.act { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 4px 10px; border: 0; border-radius: 14px;
       background: var(--tonal); color: var(--on-tonal); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.act svg { width: 24px; height: 24px; fill: currentColor; }
.act:hover { filter: brightness(1.05); }
.act:disabled { opacity: .45; cursor: default; filter: none; }
.person-more { display: flex; justify-content: center; gap: 24px; margin-top: 14px; }
.danger-link, .danger-text { color: var(--danger) !important; }
.btn.danger { background: var(--danger); color: #fff; }
.note.error { color: var(--danger); }
#person-note { text-align: center; }
#report-form textarea { resize: vertical; min-height: 64px; }
#report-form .row .btn, #person-confirm .row .btn, #lounge-leave-box .row .btn { flex: 1; }

@media (max-width: 767px) {
  .dlg { margin: auto 0 0; width: 100vw; }
  .dlg-card { width: 100vw; max-height: 88vh; border-radius: 18px 18px 0 0; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .dlg.tall .dlg-card { height: 88vh; }
  .vnote-circle { width: 200px; height: 200px; }
}
.list-pane.tab-calls #online, .list-pane.tab-calls #lounge-join { display: none; }
/* A computer sees the strip over the chat list right beside the lounge — the one under its header is for phones. */
@media (min-width: 768px) { .strip.compact { display: none; } }

/* --- T-091 (docs/CHAT-FEATURES.md): reactions, the message menu, mentions, big emoji, the emoji panel, the paste
   preview, the thread panel "in focus" ----------------------------------------------------------------------------- */
:root { --mention-bg: rgba(42, 125, 225, .08); --chip-mine: #d9e9ff; --scrim: rgba(0, 0, 0, .25); }
@media (prefers-color-scheme: dark) { :root { --mention-bg: rgba(76, 155, 255, .12); --chip-mine: #1d3a5f; --scrim: rgba(0, 0, 0, .45); } }

/* reactions: chips under the bubble, mine accented */
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 9px; border: 1px solid var(--line);
        border-radius: 999px; background: var(--bg); color: var(--fg); font: inherit; font-size: 14px; cursor: pointer; }
.chip:hover { background: var(--card); }
.chip.mine { background: var(--chip-mine); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip:disabled { cursor: default; }
.chip-emoji { font-size: 16px; line-height: 1; }
.chip-count { font-variant-numeric: tabular-nums; }

/* the "…" on hover (a computer) — beside the bubble; the menu over (or under) the message */
.msg-more { align-self: center; flex: none; width: 30px; height: 30px; margin: 0 4px; border: 0; border-radius: 50%; padding: 0;
            display: flex; align-items: center; justify-content: center; background: none; color: var(--muted); cursor: pointer;
            opacity: 0; }
.msg-more svg { width: 20px; height: 20px; fill: currentColor; }
.msg.mine .msg-more { order: -1; }
.msg:hover .msg-more, .msg-more:focus-visible, .msg.menu-open .msg-more { opacity: 1; }
.msg-more:hover { background: var(--card); }
@media (hover: none) { .msg-more { display: none; } }
.msg-menu { position: absolute; z-index: 6; bottom: calc(100% - 4px); left: 0; min-width: 220px; padding: 6px; border-radius: 16px;
            background: var(--bg); box-shadow: 0 6px 28px rgba(0, 0, 0, .22); border: 1px solid var(--line); }
.msg.mine .msg-menu { left: auto; right: 0; }
.msg.in-group .msg-menu { left: 38px; }
.msg-menu.below { bottom: auto; top: calc(100% - 4px); }
@media (prefers-color-scheme: dark) { .msg-menu { background: #1c1c1e; } }
.menu-reacts { display: flex; gap: 2px; }
.menu-react { width: 38px; height: 38px; flex: none; border: 0; border-radius: 50%; padding: 0; background: none; font-size: 22px;
              line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.menu-react:hover, .menu-react:focus-visible { background: var(--card); }
.menu-react.mine { background: var(--chip-mine); }
.menu-react svg { width: 22px; height: 22px; fill: currentColor; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 4px; padding: 9px 10px; border: 0; border-radius: 10px;
             background: none; color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.menu-item:hover, .menu-item:focus-visible { background: var(--card); }
.menu-item svg { width: 20px; height: 20px; fill: var(--accent); flex: none; }
@media (prefers-reduced-motion: no-preference) {
  .msg-menu { animation: menu-in .14s ease-out; }
  @keyframes menu-in { from { opacity: 0; transform: translateY(6px) scale(.97); } }
}

/* mentions: highlighted names; a message that mentions me — an accent bar and a light background */
.mention { color: var(--accent); font-weight: 600; }
.mention.me { background: var(--mention-bg); border-radius: 4px; padding: 0 2px; }
.msg.mentioned { background: var(--mention-bg); box-shadow: inset 3px 0 0 var(--accent); border-radius: 6px; padding: 2px 0 2px 6px; }
.chat-at { flex: none; min-width: 22px; height: 22px; border-radius: 11px; background: var(--accent); color: var(--on-accent);
           font-size: 13px; font-weight: 700; line-height: 22px; text-align: center; }

/* 1–3 emoji alone: big, no bubble */
.bubble.emoji-only { background: none !important; padding: 0 2px; }
.bubble.emoji-only .msg-text { font-size: 44px; line-height: 1.15; }
.bubble.emoji-only.emoji-3 .msg-text { font-size: 36px; }

/* a thread's way in under its root */
.thread-sum { display: inline-flex; align-items: center; gap: 6px; margin: 3px 0 0; padding: 3px 10px 3px 4px; border: 0; border-radius: 999px;
              background: none; color: var(--accent); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.thread-sum:hover { background: var(--card); }
.thread-faces { display: inline-flex; }
.thread-face { width: 22px; height: 22px; font-size: 11px; border: 2px solid var(--bg); margin-left: -6px; }
.thread-face:first-child { margin-left: 0; }
.thread-time { color: var(--muted); font-weight: 400; font-size: 13px; }
.thread-new { padding: 0 7px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 12px; }
.orphan .orphan-btn { padding: 2px 12px; background: var(--card); font-size: 13px; }
/* T-094 §5.5: a thread's replies in the main list — under the root, shifted right, the thread's thin line on the left
   running from the root through the replies to the thread's row (gap 4px of .msgs is bridged by top: -4px). */
.msgs > .thread-flow { position: relative; margin-left: 36px; }
.msgs > .thread-flow::before { content: ""; position: absolute; left: -20px; top: -4px; bottom: 0; width: 2px; border-radius: 1px;
                               background: var(--line); }
.msgs > .thread-line::before { bottom: 50%; }
.thread-row { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; }
.thread-row .thread-sum { min-width: 0; }
.thread-fold { flex: none; width: 30px; height: 30px; margin-top: 3px; padding: 0; border: 0; border-radius: 50%; background: none;
               color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.thread-fold:hover, .thread-fold:focus-visible { background: var(--card); color: var(--fg); }
.thread-fold svg { width: 22px; height: 22px; fill: currentColor; }
.thread-more .small-link { margin: 0; padding: 2px 4px; font-size: 14px; color: var(--accent); }
@media (max-width: 767px) {
  .msgs > .thread-flow { margin-left: 28px; }
  .msgs > .thread-flow::before { left: -16px; }
}

/* the emoji panel — above the composer, in the flow (the list shrinks, as with a phone's keyboard) */
.emoji-panel { flex: none; height: 300px; display: flex; flex-direction: column; border-top: 1px solid var(--line); background: var(--bg); }
.emoji-tabs { display: flex; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; }
.emoji-tab { width: 36px; height: 34px; flex: none; border: 0; border-radius: 8px; background: none; font-size: 20px; cursor: pointer; padding: 0; }
.emoji-tab:hover { background: var(--card); }
.emoji-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 6px 8px; overscroll-behavior: contain; position: relative; }
.emoji-cat { margin: 8px 4px 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
.emoji { height: 40px; border: 0; border-radius: 8px; padding: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer;
         font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.emoji:hover, .emoji:focus-visible { background: var(--card); }
.emoji-empty { margin: 4px; font-size: 14px; color: var(--muted); }
.emoji-toggle[aria-expanded="true"] { background: var(--card); }
@media (max-width: 767px) { .emoji-panel { height: 260px; } }

/* the paste / drop preview */
.paste-title { margin-bottom: 12px; }
.paste-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; max-height: 50vh; overflow-y: auto; }
.paste-item { flex: 1 1 140px; min-width: 0; }
.paste-pic { display: block; width: 100%; max-height: 40vh; object-fit: contain; border-radius: 12px; background: var(--card); }
.paste-file { padding: 10px 12px; border-radius: 12px; background: var(--card); }
#paste-dlg .row .btn { flex: 1; }
.conv.drag-over::after { content: ""; position: absolute; inset: 8px; border: 3px dashed var(--accent); border-radius: 16px;
                         pointer-events: none; z-index: 7; }

/* the thread "in focus" (§5.3): the conversation blurred and dimmed behind, the panel on top */
.thread { position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center; }
.thread-backdrop { position: absolute; inset: 0; background: var(--scrim);
                   -webkit-backdrop-filter: blur(16px) saturate(.9); backdrop-filter: blur(16px) saturate(.9); }
.thread-card { position: relative; display: flex; flex-direction: column; width: min(640px, calc(100% - 32px)); height: 85%;
               border-radius: 16px; overflow: hidden; background: var(--bg); box-shadow: 0 16px 60px rgba(0, 0, 0, .35); }
@media (prefers-color-scheme: dark) { .thread-card { background: #161618; } }
.thread-head { display: flex; align-items: center; gap: 8px; padding: 10px 8px 10px 16px; border-bottom: 1px solid var(--line); flex: none; }
.thread-titles { flex: 1; min-width: 0; }
.thread-title { margin: 0; font-weight: 700; }
.thread-sub { margin: 0; font-size: 13px; color: var(--muted); }
.thread-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 12px 8px; overscroll-behavior: contain; }
.thread-missing { margin: 4px auto 10px; max-width: 420px; padding: 10px 14px; border-radius: 12px; border: 1px dashed var(--line);
                  color: var(--muted); font-style: italic; text-align: center; font-size: 15px; }
.thread-sep { display: flex; align-items: center; gap: 10px; margin: 10px 0 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
.thread-sep::before, .thread-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.thread-root .bubble { box-shadow: 0 6px 24px rgba(0, 0, 0, .14); }
.thread-root.clamped .msg-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; line-clamp: 6; overflow: hidden; }
.show-all { margin-top: 2px; }
.conv.thread-open > .conv-head, .conv.thread-open > .conv-scroll, .conv.thread-open > .composer { pointer-events: none; }
/* A phone: the panel takes the width, a strip of the blurred chat stays visible on top. */
@media (max-width: 767px) {
  .thread { align-items: stretch; }
  .thread-card { width: 100%; height: auto; margin-top: max(56px, calc(env(safe-area-inset-top) + 48px)); border-radius: 16px 16px 0 0; }
}
