/* MeWe TeamUp — design tokens follow the other MeWe apps (blue/purple accent, system theme by default). Sizes are in rem: the text-size setting changes the root size. */
:root {
  --fs: 1;
  --bg: #ffffff; --surface: #f6f7fb; --raised: #ffffff; --text: #1f2430; --muted: #6b7385; --border: #e1e4ee;
  --primary: #5b6cf2; --primary-ink: #ffffff; --primary-weak: #e9ebff; --danger: #d63c5a; --mention: #fff3c4; --mention-ink: #7a5b00;
  --side: #2a2a5c; --side-ink: #d9dcf5; --side-muted: #9da1d0; --side-hover: #35356f; --side-active: #5b6cf2;
  --online: #2bb673; --away: #f0a83a; --offline: #9aa1b5; --shadow: 0 8px 28px rgba(20, 24, 50, .18);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #14161d; --surface: #1b1e28; --raised: #232733; --text: #e8eaf2; --muted: #9aa1b5; --border: #2d3140; --primary: #7e8bff; --primary-weak: #272c52; --mention: #4a3f12; --mention-ink: #ffe28a; --side: #0f1020; --side-hover: #1a1c36; --shadow: 0 8px 28px rgba(0, 0, 0, .5); } }
:root[data-theme="dark"] { --bg: #14161d; --surface: #1b1e28; --raised: #232733; --text: #e8eaf2; --muted: #9aa1b5; --border: #2d3140; --primary: #7e8bff; --primary-weak: #272c52; --mention: #4a3f12; --mention-ink: #ffe28a; --side: #0f1020; --side-hover: #1a1c36; --shadow: 0 8px 28px rgba(0, 0, 0, .5); }

* { box-sizing: border-box; }
html { font-size: calc(16px * var(--fs)); -webkit-text-size-adjust: 100%; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 1rem/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif; overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); }
.boot { padding: 2rem; color: var(--muted); }
.hidden { display: none !important; }

/* sign-in screen */
.landing { height: 100%; display: grid; place-items: center; padding: 1.5rem; background: linear-gradient(135deg, #5b6cf2, #0984e3); }
.landing .card { background: var(--raised); border-radius: 1rem; padding: 2rem 1.75rem; width: min(26rem, 100%); text-align: center; box-shadow: var(--shadow); }
.landing img { width: 4.5rem; height: 4.5rem; border-radius: 1rem; }
.landing h1 { margin: .75rem 0 .25rem; font-size: 1.6rem; }
.landing p { color: var(--muted); margin: 0 0 1.25rem; }

/* shell */
.shell { height: 100%; height: 100dvh; display: grid; grid-template-columns: 16.5rem minmax(0, 1fr); }
.shell.has-thread { grid-template-columns: 16.5rem minmax(0, 1fr) minmax(18rem, 26rem); }
.sidebar { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; min-height: 0; }
.ws-btn { display: flex; align-items: center; gap: .6rem; padding: .85rem 1rem; border: 0; background: none; color: #fff; font-weight: 700; font-size: 1.05rem; text-align: left; border-bottom: 1px solid rgba(255, 255, 255, .1); width: 100%; }
.ws-btn img { width: 1.9rem; height: 1.9rem; border-radius: .45rem; }
.ws-btn span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-scroll { flex: 1; overflow-y: auto; padding: .5rem 0; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: .6rem 1rem .25rem; color: var(--side-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.side-head button { background: none; border: 0; color: var(--side-muted); font-size: 1.15rem; line-height: 1; padding: 0 .25rem; border-radius: .3rem; }
.side-head button:hover { color: #fff; background: var(--side-hover); }
.chan { display: flex; align-items: center; gap: .5rem; width: 100%; padding: .3rem 1rem; border: 0; background: none; color: var(--side-ink); text-align: left; border-radius: 0; }
.chan:hover { background: var(--side-hover); }
.chan.active { background: var(--side-active); color: #fff; }
.chan .hash { width: 1rem; text-align: center; opacity: .8; flex: none; }
.chan .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan.unread .nm { font-weight: 700; color: #fff; }
.chan.preview .nm { opacity: .65; }
.badge { background: var(--danger); color: #fff; font-size: .75rem; font-weight: 700; border-radius: 1rem; padding: 0 .45rem; min-width: 1.3rem; text-align: center; }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; border: 2px solid var(--side); background: var(--offline); flex: none; }
.dot.online { background: var(--online); } .dot.away { background: var(--away); }
.dot.light { border-color: var(--bg); }
.me-bar { display: flex; align-items: center; gap: .6rem; padding: .6rem 1rem; border-top: 1px solid rgba(255, 255, 255, .1); }
.me-bar .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: #fff; }
.icon-btn { background: none; border: 0; border-radius: .4rem; padding: .3rem .45rem; color: inherit; font-size: 1.1rem; line-height: 1; }
.icon-btn:hover { background: rgba(127, 127, 160, .2); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.top { display: flex; align-items: center; gap: .6rem; padding: .6rem 1rem; border-bottom: 1px solid var(--border); min-height: 3.2rem; }
.top h2 { margin: 0; font-size: 1.1rem; white-space: nowrap; }
.top .topic { flex: 1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; font-size: .9rem; }
.top .menu-btn { display: none; }
.pill { border: 1px solid var(--border); background: var(--surface); border-radius: .5rem; padding: .25rem .6rem; font-size: .9rem; }
.pill:hover { border-color: var(--primary); }
.msgs { flex: 1; overflow-y: auto; padding: .5rem 0 .25rem; min-height: 0; overscroll-behavior: contain; }
.load-more { display: block; margin: .5rem auto; background: var(--surface); border: 1px solid var(--border); border-radius: 1rem; padding: .25rem 1rem; color: var(--muted); }
.day { display: flex; align-items: center; gap: .75rem; margin: 1rem 1rem .5rem; color: var(--muted); font-size: .8rem; font-weight: 600; }
.day::before, .day::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.msg { display: flex; gap: .7rem; padding: .25rem 1rem; position: relative; }
.msg:hover { background: var(--surface); }
.msg.cont { padding-top: 0; padding-bottom: 0; }
.avatar { width: 2.3rem; height: 2.3rem; border-radius: .5rem; color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; position: relative; user-select: none; }
.avatar .dot { position: absolute; right: -.25rem; bottom: -.25rem; }
.avatar.sm { width: 1.8rem; height: 1.8rem; font-size: .8rem; border-radius: .4rem; }
.msg .gutter { width: 2.3rem; flex: none; color: transparent; font-size: .7rem; text-align: right; padding-top: .2rem; }
.msg.cont:hover .gutter { color: var(--muted); }
.msg .body { min-width: 0; flex: 1; }
.msg .who { font-weight: 700; margin-right: .5rem; }
.msg .when { color: var(--muted); font-size: .78rem; }
.msg .edited { color: var(--muted); font-size: .75rem; }
.text { overflow-wrap: anywhere; }
.text pre { background: var(--surface); border: 1px solid var(--border); border-radius: .4rem; padding: .5rem .7rem; overflow-x: auto; margin: .25rem 0; }
.text code { background: var(--surface); border: 1px solid var(--border); border-radius: .3rem; padding: 0 .3rem; font: .9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.text pre code { border: 0; padding: 0; background: none; }
.text blockquote { margin: .25rem 0; padding: 0 .75rem; border-left: .25rem solid var(--border); color: var(--muted); }
.text ul { margin: .25rem 0; padding-left: 1.4rem; }
.mention { background: var(--primary-weak); color: var(--primary); border-radius: .3rem; padding: 0 .25rem; font-weight: 600; }
.mention.me { background: var(--mention); color: var(--mention-ink); }
.deleted { color: var(--muted); font-style: italic; }
.replies-link { display: inline-flex; gap: .4rem; align-items: center; margin-top: .2rem; border: 0; background: none; color: var(--primary); font-size: .85rem; padding: .1rem .3rem; border-radius: .3rem; }
.replies-link:hover { background: var(--primary-weak); }
.actions { position: absolute; right: 1rem; top: -.9rem; display: none; background: var(--raised); border: 1px solid var(--border); border-radius: .5rem; box-shadow: var(--shadow); padding: .1rem; }
.msg:hover .actions, .msg:focus-within .actions { display: flex; }
.actions button { background: none; border: 0; border-radius: .35rem; padding: .25rem .5rem; color: var(--muted); }
.actions button:hover { background: var(--primary-weak); color: var(--primary); }
.edit-box textarea { width: 100%; }
.typing { height: 1.3rem; padding: 0 1rem; color: var(--muted); font-size: .82rem; }
.composer { padding: 0 1rem 1rem; }
.composer .box { border: 1px solid var(--border); border-radius: .7rem; background: var(--raised); display: flex; align-items: flex-end; gap: .4rem; padding: .35rem .4rem .35rem .7rem; }
.composer .box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-weak); }
.composer textarea { flex: 1; border: 0; outline: 0; background: none; resize: none; max-height: 9rem; min-height: 1.5rem; padding: .25rem 0; line-height: 1.4; }
.send { background: var(--primary); color: var(--primary-ink); border: 0; border-radius: .5rem; padding: .35rem .8rem; font-weight: 700; }
.send:disabled { opacity: .45; cursor: default; }
.hint { color: var(--muted); font-size: .75rem; margin: .2rem .2rem 0; }
.banner { margin: 0 1rem .75rem; background: var(--primary-weak); border-radius: .6rem; padding: .6rem .9rem; display: flex; gap: .75rem; align-items: center; }
.banner .btn { margin-left: auto; }

.thread { border-left: 1px solid var(--border); background: var(--bg); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.thread .top h2 { font-size: 1rem; }
.thread .msgs { padding-top: .25rem; }
.thread .root { border-bottom: 1px solid var(--border); padding-bottom: .5rem; margin-bottom: .5rem; }

.btn { border: 1px solid var(--border); background: var(--surface); border-radius: .5rem; padding: .45rem .9rem; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); font-weight: 700; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; }
.field { display: block; margin: 0 0 .9rem; }
.field > span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .25rem; }
.field input[type=text], .field textarea, .field select { width: 100%; border: 1px solid var(--border); background: var(--bg); border-radius: .5rem; padding: .5rem .65rem; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--primary-weak); border-color: var(--primary); }
.check { display: flex; gap: .5rem; align-items: center; margin: 0 0 .9rem; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: .5rem; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: .4rem .9rem; border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); font-weight: 700; }
.err { color: var(--danger); min-height: 1.2rem; font-size: .9rem; }

.overlay { position: fixed; inset: 0; background: rgba(10, 12, 30, .5); display: grid; place-items: center; padding: 1rem; z-index: 50; }
.modal { background: var(--raised); border-radius: .9rem; box-shadow: var(--shadow); width: min(28rem, 100%); max-height: min(90dvh, 40rem); display: flex; flex-direction: column; }
.modal > h3 { margin: 0; padding: 1rem 1.1rem .5rem; font-size: 1.1rem; }
.modal .content { padding: .25rem 1.1rem 1rem; overflow-y: auto; }
.modal .foot { display: flex; justify-content: flex-end; gap: .5rem; padding: .75rem 1.1rem 1rem; border-top: 1px solid var(--border); }
.list-row { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .45rem .5rem; border: 0; background: none; border-radius: .5rem; text-align: left; }
.list-row:hover { background: var(--surface); }
.list-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row small { color: var(--muted); }
.menu { position: fixed; background: var(--raised); border: 1px solid var(--border); border-radius: .7rem; box-shadow: var(--shadow); padding: .35rem; z-index: 60; min-width: 14rem; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: .45rem .7rem; border-radius: .4rem; }
.menu button:hover { background: var(--primary-weak); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: .3rem 0; }
.toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); background: #202437; color: #fff; padding: .55rem 1rem; border-radius: .6rem; z-index: 80; box-shadow: var(--shadow); max-width: 90vw; }
.toast.bad { background: var(--danger); }
.conn { position: fixed; top: 0; left: 50%; transform: translateX(-50%); background: var(--away); color: #222; padding: .15rem .9rem; border-radius: 0 0 .6rem .6rem; font-size: .8rem; z-index: 70; }

@media (max-width: 820px) {
  .shell, .shell.has-thread { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(19rem, 86vw); z-index: 40; transform: translateX(-102%); transition: transform .18s ease; box-shadow: var(--shadow); }
  .shell.drawer .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(10, 12, 30, .45); z-index: 30; }
  .top .menu-btn { display: inline-block; }
  .thread { position: fixed; inset: 0; z-index: 35; border-left: 0; }
  .actions { display: flex; top: .1rem; background: transparent; border: 0; box-shadow: none; }
  .composer { padding-bottom: calc(.75rem + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---- search, admin tags, channel call indicator ---- */
.search-btn { display: flex; align-items: center; gap: .6rem; margin: .6rem .75rem 0; padding: .45rem .7rem; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .08); color: var(--side-ink); border-radius: .5rem; text-align: left; }
.search-btn:hover { background: var(--side-hover); }
.search-btn .nm { flex: 1; }
.search-btn kbd { font: inherit; font-size: .72rem; opacity: .7; border: 1px solid rgba(255, 255, 255, .25); border-radius: .3rem; padding: 0 .3rem; }
@media (max-width: 820px) { .search-btn kbd { display: none; } }
.role-tag { margin-left: .4rem; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; background: var(--primary); color: var(--primary-ink); border-radius: .3rem; padding: .05rem .35rem; vertical-align: middle; }
.incall { font-size: .85rem; }
.pill.danger { color: var(--danger); }
.pill.call-join { background: var(--online); border-color: var(--online); color: #fff; font-weight: 700; }
.search-box { width: 100%; font: inherit; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: .5rem; background: var(--bg); color: var(--text); }
.search-out { margin-top: .75rem; max-height: 55vh; overflow: auto; }
.sr-head { color: var(--muted); padding-left: .5rem; }
.msg-hit .grow { white-space: normal; }
.msg-hit .snip { overflow-wrap: anywhere; }
.msg-hit mark, .snip mark { background: var(--mention); color: var(--mention-ink); border-radius: .2rem; padding: 0 .1rem; }
.msg.flash { animation: flash 2.5s ease-out; }
@keyframes flash { 0%, 40% { background: var(--mention); } 100% { background: transparent; } }
.hint.err, .err { color: var(--danger); }

/* ---- calls ---- */
.ring { position: fixed; z-index: 80; top: 1rem; right: 1rem; left: auto; width: min(22rem, calc(100vw - 2rem)); background: var(--raised); color: var(--text); border: 1px solid var(--border); border-radius: .9rem; box-shadow: var(--shadow); padding: 1rem; animation: ringpulse 1.6s ease-in-out infinite; }
.ring-title { font-weight: 700; }
.ring-sub { color: var(--muted); margin: .15rem 0 .8rem; }
.ring-btns { display: flex; gap: .6rem; justify-content: flex-end; }
@keyframes ringpulse { 50% { box-shadow: 0 0 0 .35rem rgba(91, 108, 242, .25), var(--shadow); } }
.call { position: fixed; inset: 0; z-index: 70; background: #0d0f16; color: #fff; display: flex; flex-direction: column; }
.call-head { display: flex; flex-direction: column; align-items: center; padding: .8rem 1rem .4rem; }
.call-title { font-weight: 700; }
.call-status { color: #aab0c8; font-size: .9rem; }
.call-tiles { flex: 1; min-height: 0; display: grid; gap: .6rem; padding: .6rem; grid-template-columns: 1fr; align-content: center; }
.call-tiles[data-n="2"] { grid-template-columns: repeat(2, 1fr); }
.call-tiles[data-n="3"], .call-tiles[data-n="4"] { grid-template-columns: repeat(2, 1fr); }
.call-tiles[data-n="5"], .call-tiles[data-n="6"] { grid-template-columns: repeat(3, 1fr); }
.call-tiles[data-n="7"], .call-tiles[data-n="8"], .call-tiles[data-n="9"] { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 820px) { .call-tiles[data-n="2"] { grid-template-columns: 1fr; } .call-tiles[data-n="3"], .call-tiles[data-n="4"], .call-tiles[data-n="5"], .call-tiles[data-n="6"] { grid-template-columns: repeat(2, 1fr); } }
.tile { position: relative; background: #1b1e2b; border-radius: .8rem; overflow: hidden; aspect-ratio: 16 / 10; min-height: 0; display: flex; align-items: center; justify-content: center; }
.tile video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.tile.me video { transform: scaleX(-1); }
.tile.novideo video { position: absolute; width: 1px; height: 1px; opacity: 0; }
.tile-av { display: none; width: 5rem; height: 5rem; border-radius: 50%; background: var(--primary); align-items: center; justify-content: center; font-size: 1.8rem; font-weight: 700; }
.tile.novideo .tile-av { display: flex; }
.tile-nm { position: absolute; left: .5rem; bottom: .4rem; background: rgba(0, 0, 0, .55); border-radius: .35rem; padding: .1rem .5rem; font-size: .85rem; }
.call-ctl { display: flex; gap: 1rem; justify-content: center; padding: .8rem 1rem calc(1rem + env(safe-area-inset-bottom)); }
.call-btn { width: 3.4rem; height: 3.4rem; border-radius: 50%; border: 0; background: #2a2e40; color: #fff; font-size: 1.4rem; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.call-btn:hover { background: #3a3f57; }
.call-btn.off { background: #fff; color: #222; }
.call-btn.hang { background: var(--danger); transform: rotate(135deg); }

/* ---- file sharing ---- */
.attach { align-self: flex-end; border: 0; background: none; font-size: 1.25rem; line-height: 1; padding: .45rem .4rem .45rem .6rem; color: var(--muted); border-radius: .5rem; }
.attach:hover { color: var(--primary); }
.main.dropping::after { content: 'Drop files to share them'; position: absolute; inset: .5rem; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; font-weight: 700; color: var(--primary); background: color-mix(in srgb, var(--primary-weak) 85%, transparent); border: 3px dashed var(--primary); border-radius: 1rem; z-index: 20; pointer-events: none; }
.main { position: relative; }
.upload { display: flex; align-items: center; gap: .6rem; margin: 0 0 .4rem; font-size: .88rem; color: var(--muted); }
.upload .up-nm { flex: 0 1 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload .up-bar { flex: 1; height: .45rem; background: var(--border); border-radius: .3rem; overflow: hidden; }
.upload .up-bar i { display: block; height: 100%; background: var(--primary); transition: width .15s; }
.atts { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .3rem; }
.att.media { max-width: min(26rem, 100%); }
.att-img { display: block; max-width: 100%; max-height: 20rem; border-radius: .6rem; border: 1px solid var(--border); background: var(--surface); }
.att-cap { font-size: .8rem; color: var(--muted); margin-top: .2rem; overflow-wrap: anywhere; }
.att-dl { text-decoration: none; margin-left: .3rem; }
.att.file { display: flex; align-items: center; gap: .6rem; padding: .5rem .8rem; border: 1px solid var(--border); border-radius: .6rem; background: var(--surface); color: inherit; text-decoration: none; max-width: 100%; }
.att.file:hover { border-color: var(--primary); }
.att-ic { font-size: 1.6rem; }
.att-nm { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.att-nm small { color: var(--muted); font-weight: 400; }
.thread .msgs .att.media { max-width: 100%; }
.tile.me.sharing video { transform: none; object-fit: contain; }

/* ---- friends, icon buttons, small screens ---- */
.side-tools { display: flex; gap: .5rem; margin: .6rem .75rem 0; }
.side-tools .search-btn { flex: 1; margin: 0; min-width: 0; }
.friends-btn { position: relative; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .08); color: var(--side-ink); border-radius: .5rem; padding: 0 .7rem; font-size: 1.1rem; }
.friends-btn:hover { background: var(--side-hover); }
.friends-btn .badge { position: absolute; top: -.4rem; right: -.35rem; }
.fr-btn { border: 1px solid var(--border); background: var(--surface); border-radius: .9rem; font-size: .72rem; line-height: 1; padding: .12rem .4rem; margin-left: .35rem; vertical-align: middle; color: var(--primary); }
.fr-btn.in { background: var(--online); border-color: var(--online); color: #fff; }
.fr-btn.out { color: var(--muted); }
.fr-btn:hover { border-color: var(--primary); }
.icon-btn.ok { color: var(--online); }
.icon-btn.danger { color: var(--danger); }
.icon-btn.count, .icon-btn.call-join { font-size: .95rem; border: 1px solid var(--border); background: var(--surface); border-radius: .5rem; padding: .3rem .5rem; }
.icon-btn.call-join { background: var(--online); border-color: var(--online); color: #fff; font-weight: 700; }
.banner .icon-btn.bn { margin-left: auto; font-size: 1.2rem; border: 1px solid var(--border); background: var(--raised); }
.banner .icon-btn.bn + .icon-btn.bn { margin-left: .4rem; }
.top .icon-btn { flex: 0 0 auto; width: 2.4rem; height: 2.4rem; padding: 0; display: inline-flex; align-items: center; justify-content: center; position: relative; font-size: 1.1rem; border: 1px solid var(--border); background: var(--surface); border-radius: .5rem; }   /* every header button: the same square */
.top .icon-btn:hover { background: rgba(127, 127, 160, .2); }
.top .icon-btn.call-join { background: var(--online); border-color: var(--online); color: #fff; }
.top .icon-btn.danger { color: var(--danger); }
.top .icon-btn .n { position: absolute; top: -.35rem; right: -.35rem; min-width: 1.1rem; height: 1.1rem; padding: 0 .25rem; border-radius: .6rem; background: var(--primary); color: var(--primary-ink); font-size: .68rem; line-height: 1.1rem; font-weight: 700; text-align: center; }
.top .icon-btn.call-join .n { background: #fff; color: #167a3a; }
.send { font-size: 1.15rem; line-height: 1; padding: .45rem .8rem; }
/* nothing may be wider than the screen: the header shrinks (name truncates), dialogs fit the width, the page never scrolls sideways */
html, body { max-width: 100%; overflow-x: hidden; }
.shell, .main { max-width: 100vw; overflow-x: hidden; }
.top { min-width: 0; overflow: hidden; }
.top h2 { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.top .topic { min-width: 0; }
.overlay { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.modal { min-width: 0; max-width: 100%; }
.modal .content, .modal .foot { min-width: 0; }
.list-row { min-width: 0; }
.composer .hint { overflow-wrap: anywhere; }
@media (max-width: 820px) {
  .top { padding: .5rem .6rem; gap: .25rem; }
  .top .topic { display: none; }
  .top h2 { flex: 1 1 auto; font-size: 1rem; }
  .top .icon-btn { width: 2.2rem; height: 2.2rem; }
  .composer .hint { display: none; }
  .modal { width: 100%; }
  .toast { max-width: calc(100vw - 1.5rem); }
  .ring { left: .75rem; right: .75rem; width: auto; }
}

/* ---- unread red dot, channel "More" ---- */
.udot { width: .6rem; height: .6rem; border-radius: 50%; background: #ff3b4f; flex: 0 0 auto; box-shadow: 0 0 0 2px var(--side); }
.chan.more { color: var(--side-muted); font-size: .9rem; }
.chan.more .hash { width: 1rem; text-align: center; }
body.in-call .overlay { z-index: 90; }

/* call transcripts (channel owner) and Bible verse cards of the AI abstract */
.call-btn.on { background: var(--accent, #2563eb); color: #fff; }
.tr-wrap { max-height: 70vh; overflow: auto; }
.tr-lines { max-height: 40vh; overflow: auto; border: 1px solid var(--border, #d0d7de); border-radius: 8px; padding: .5rem .75rem; margin-top: .4rem; }
.tr-line { margin: .25rem 0; }
.tr-at { color: var(--muted, #57606a); font-size: .8em; }
.tr-note { margin: .5rem 0; }
.bible-card { margin: .4rem 0; padding: .5rem .75rem; border-left: 4px solid var(--accent, #2563eb); background: rgba(37, 99, 235, .07); border-radius: 6px; }
.bible-ref { font-weight: 600; display: block; }
.bible-card sup { color: var(--muted, #57606a); margin-right: .15em; }
.md-h { font-weight: 700; margin: .6rem 0 .2rem; }

.tile.stuck { outline: 2px dashed #d97706; }
.tile.stuck .tile-nm::after { content: ' · connecting…'; }

/* alone in a call: one picture of a sensible size in the middle, not a screen-wide strip */
.call-tiles[data-n="1"] .tile { width: min(100%, 70vh * 1.6); justify-self: center; }

.call-note { display: flex; gap: .6rem; align-items: flex-start; margin: 0 auto; max-width: min(40rem, 92vw); padding: .5rem .8rem; border-radius: .6rem; background: #3a2a10; color: #fde9c0; border: 1px solid #d97706; font-size: .9rem; }
.call-note-x { background: none; border: 0; color: inherit; cursor: pointer; font-size: 1rem; }

.call-btn.qual { font-size: .78rem; line-height: 1.15; white-space: pre-line; text-align: center; }   /* same round size as the other call buttons */

/* live transcript button: bars move with your voice; colour shows the state */
.call-btn .sc-bars { display: none; align-items: center; gap: 2px; height: 1.1rem; margin-left: .3rem; }
.call-btn .sc-bars i { display: block; width: 3px; height: 20%; border-radius: 2px; background: currentColor; transition: height .1s; }
.call-btn.on { flex-direction: column; font-size: 1.1rem; }
.call-btn.on .sc-bars { display: flex; margin: 0; }
.call-btn.on .sc-ic { line-height: 1; }
.call-btn[data-state="sending"] { animation: sc-pulse 1s ease-in-out infinite; }
.call-btn[data-state="ok"] { box-shadow: 0 0 0 3px #22c55e; }
.call-btn[data-state="error"] { background: var(--danger); box-shadow: 0 0 0 3px #fca5a5; }
@keyframes sc-pulse { 50% { box-shadow: 0 0 0 5px rgba(37, 99, 235, .45); } }

/* live transcript window inside the call */
.call-caps { margin: 0 auto .4rem; width: min(42rem, 94vw); max-height: 28vh; display: flex; flex-direction: column; background: rgba(255, 255, 255, .08); border-radius: .6rem; font-size: .9rem; }
.call-caps[hidden] { display: none; }
.call-caps-head { display: flex; justify-content: space-between; gap: .6rem; padding: .35rem .7rem; font-weight: 700; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.call-caps-state { font-weight: 400; color: #a7f3d0; text-align: right; }
.call-caps-state.bad { color: #fca5a5; }
.call-caps-lines { overflow-y: auto; padding: .4rem .7rem; min-height: 2.2rem; }
.call-caps-lines p { margin: .15rem 0; }
.call-caps-at { color: #aab0c8; font-size: .8rem; }
.call-caps-lines:empty::before { content: "Speak: what you say appears here."; color: #aab0c8; }
