/* Tamas.af – web app styles. Brand colour #066287 */
:root {
  --brand: #066287; --brand-dark: #044a66; --brand-soft: #E3F1F6;
  --ink: #0B2A36; --muted: #52636B; --line: #DCE6EA; --bg: #F3F7F9; --chat-bg: #EAF1F4;
  --out: #D4EAF2; --in: #FFFFFF; --read: #1A8CD8; --ok: #1F7A4D; --danger: #B42318;
  --body-font: 'Noto Naskh Arabic', 'Inter', system-ui, sans-serif;
  --head-font: 'Scheherazade New', 'Noto Naskh Arabic', serif;
  --num-font: 'Inter', system-ui, sans-serif;
}
html[lang="en"] { --body-font: 'Inter', system-ui, sans-serif; --head-font: 'Inter', system-ui, sans-serif; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--body-font); color: var(--ink); background: var(--bg); font-size: 16px; line-height: 1.7; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 14px; }
.grow { flex: 1; }
.ltr-num { direction: ltr; unicode-bidi: isolate; font-family: var(--num-font); }

/* headings use Scheherazade New */
.title, .h-title, .conv-name, .chat-name, .btn, .lang-btn span, .step span { font-family: var(--head-font); }
.title { font-size: 30px; font-weight: 700; margin: 0; line-height: 1.4; }
.h-title { font-size: 28px; font-weight: 700; margin: 0; }
html[lang="en"] .title { font-size: 24px; }
html[lang="en"] .h-title { font-size: 22px; }

/* ---------- auth screens ---------- */
.screen.center { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 24px 16px; }
.card { width: 100%; max-width: 440px; background: #fff; border: 1px solid var(--line); border-radius: 24px; padding: 32px 28px; display: flex; flex-direction: column; gap: 14px; }
#screen-lang .card { align-items: stretch; text-align: center; }
.logo-big { width: 260px; max-width: 80%; height: auto; align-self: center; }
.logo-mid { width: 200px; height: auto; }
.icon-mid { width: 72px; height: 72px; border-radius: 18px; align-self: center; }
.faded { opacity: .5; }
.step { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.step b { width: 30px; height: 30px; border-radius: 15px; background: var(--brand); color: #fff; display: grid; place-items: center; font-family: var(--num-font); font-size: 14px; }
.label { font-weight: 700; font-size: 15px; }
.lang-list { display: flex; flex-direction: column; gap: 10px; margin: 6px 0; }
.lang-btn { min-height: 60px; border: 2px solid var(--line); background: #fff; border-radius: 16px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-size: 24px; font-weight: 700; }
.lang-btn .radio { width: 24px; height: 24px; border-radius: 12px; border: 2px solid #B7C6CD; }
.lang-btn.selected { border-color: var(--brand); background: var(--brand-soft); }
.lang-btn.selected .radio { border: 7px solid var(--brand); }

.phone-row { display: flex; gap: 8px; }
.cc { min-height: 54px; padding: 0 14px; border: 1px solid #B7C6CD; border-radius: 14px; display: flex; align-items: center; font-family: var(--num-font); font-weight: 600; background: var(--bg); white-space: nowrap; }
.phone-row input, .input, .code-input { flex: 1; min-width: 0; min-height: 54px; padding: 0 16px; border: 2px solid #B7C6CD; border-radius: 14px; background: #fff; }
.phone-row input { font-family: var(--num-font); font-size: 18px; }
.phone-row input:focus, .input:focus, .code-input:focus, textarea:focus, .search:focus { outline: none; border-color: var(--brand); }
.code-input { text-align: center; letter-spacing: 12px; font-family: var(--num-font); font-size: 28px; font-weight: 700; }
.input { width: 100%; }
.error { color: var(--danger); margin: 0; min-height: 0; font-size: 15px; }
.error:empty { display: none; }

.btn { min-height: 48px; padding: 0 20px; border-radius: 14px; border: 1px solid var(--line); background: #fff; font-size: 19px; font-weight: 700; cursor: pointer; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; min-height: 56px; font-size: 21px; }
.btn:disabled { opacity: .6; cursor: default; }
.link { background: none; border: none; color: var(--brand); cursor: pointer; padding: 8px 0; min-height: 44px; }
.link:disabled { color: var(--muted); cursor: default; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---------- app layout ---------- */
.screen.app { display: flex; height: 100vh; height: 100dvh; }
.rail { flex: 0 0 72px; background: var(--brand); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 0; }
.rail-logo { width: 48px; height: 48px; border-radius: 13px; border: 2px solid #fff; margin-bottom: 10px; }
.rail-btn { width: 50px; height: 50px; border-radius: 14px; border: none; background: transparent; color: #fff; display: grid; place-items: center; cursor: pointer; }
.rail-btn.active, .rail-btn:hover { background: rgba(255,255,255,.18); }

.list-pane { flex: 0 0 360px; background: #fff; border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.list-head { display: flex; align-items: center; gap: 6px; padding: 16px 18px 8px; }
.mobile-only { display: none; }
.round-btn { width: 44px; height: 44px; border-radius: 22px; border: none; background: var(--brand); color: #fff; display: grid; place-items: center; cursor: pointer; }
.search { margin: 4px 18px 10px; min-height: 42px; border: 2px solid transparent; background: var(--bg); border-radius: 12px; padding: 0 14px; }
.chat-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.chat-item { display: flex; align-items: center; gap: 12px; padding: 10px 18px; cursor: pointer; border: none; background: none; width: 100%; text-align: start; }
.chat-item:hover { background: var(--bg); }
.chat-item.active { background: var(--brand-soft); }
.chat-info { flex: 1; min-width: 0; }
.chat-top, .chat-bottom { display: flex; align-items: center; gap: 6px; }
.chat-name { font-size: 20px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-time { margin-inline-start: auto; font-family: var(--num-font); font-size: 12px; color: var(--muted); }
.chat-time.unread { color: var(--brand); font-weight: 700; }
.chat-last { flex: 1; min-width: 0; color: var(--muted); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--brand); color: #fff; font-family: var(--num-font); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.empty { padding: 24px; text-align: center; }

.avatar { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 24px; color: #fff; display: grid; place-items: center; font-family: var(--head-font); font-size: 22px; font-weight: 700; background: var(--brand); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.verified { width: 18px; height: 18px; display: inline-block; vertical-align: middle; flex: 0 0 18px; }
.verified svg { width: 18px; height: 18px; stroke: none; }

.conv-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--chat-bg); }
.conv-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 24px; }
.conv { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.conv-head { background: #fff; border-bottom: 1px solid var(--line); padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.conv-meta { flex: 1; min-width: 0; }
.conv-name { font-size: 21px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.conv-status { font-size: 14px; color: var(--muted); }
.conv-status.on { color: var(--ok); }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: none; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--bg); }
.back { display: none; color: var(--brand); }
html[dir="ltr"] .back svg { transform: scaleX(-1); }

.messages { flex: 1; overflow-y: auto; padding: 16px 5%; display: flex; flex-direction: column; gap: 6px; }
.day { align-self: center; background: #fff; border-radius: 12px; padding: 2px 14px; font-size: 13px; color: var(--muted); margin: 8px 0; }
.msg { max-width: min(75%, 560px); border-radius: 16px; padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.in { align-self: flex-start; background: var(--in); border-start-start-radius: 4px; }
.msg.out { align-self: flex-end; background: var(--out); border-start-end-radius: 4px; }
.msg-text { white-space: pre-wrap; font-size: calc(17px * var(--msg-scale, 1)); line-height: 1.75; }
.msg-meta { align-self: flex-end; display: flex; align-items: center; gap: 4px; font-family: var(--num-font); font-size: 11px; color: var(--muted); }
.msg.out .msg-meta { align-self: flex-start; }
.msg img.photo { max-width: 100%; max-height: 360px; border-radius: 12px; display: block; cursor: zoom-in; }
.tick { width: 18px; height: 12px; stroke-width: 1.8; }
.tick.sent, .tick.delivered { stroke: var(--muted); }
.tick.read, .tick.played { stroke: var(--read); }
.played-label { display: inline-flex; align-items: center; gap: 4px; font-family: var(--body-font); font-size: 12px; color: #1A6FA8; }
.played-label svg { width: 13px; height: 13px; }

.voice { display: flex; align-items: center; gap: 10px; min-width: 220px; direction: ltr; }
.voice-play { width: 40px; height: 40px; border-radius: 20px; border: none; background: var(--brand); color: #fff; display: grid; place-items: center; cursor: pointer; flex: 0 0 40px; }
.voice-play svg { width: 16px; height: 16px; fill: #fff; stroke: none; }
.voice-bar { flex: 1; height: 6px; background: #B7CFD8; border-radius: 3px; position: relative; overflow: hidden; }
.voice-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--brand); }
.voice-dur { font-family: var(--num-font); font-size: 12px; color: var(--muted); min-width: 34px; }

.composer, .recorder { background: #fff; border-top: 1px solid var(--line); padding: 10px 12px; display: flex; align-items: flex-end; gap: 8px; }
.recorder { align-items: center; font-size: 17px; }
#msg-input { flex: 1; min-width: 0; resize: none; max-height: 140px; min-height: 46px; border: 2px solid transparent; background: var(--bg); border-radius: 23px; padding: 8px 16px; font-size: calc(17px * min(var(--msg-scale, 1), 1.3)); line-height: 1.6; }
.send-btn { width: 50px; height: 50px; flex: 0 0 50px; border-radius: 25px; border: none; background: var(--brand); color: #fff; display: grid; place-items: center; cursor: pointer; }
.send-btn .ic-send { display: none; }
.send-btn.has-text .ic-send { display: block; }
.send-btn.has-text .ic-mic { display: none; }
html[dir="rtl"] .send-btn svg path[d^="M22 2"], html[dir="rtl"] #rec-send svg { transform: scaleX(-1); }
.rec-dot { width: 12px; height: 12px; border-radius: 6px; background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }

.dialog { border: none; border-radius: 20px; padding: 24px; width: min(440px, 92vw); }
.dialog::backdrop { background: rgba(11, 42, 54, .45); }
.dialog form { display: flex; flex-direction: column; gap: 10px; }
.found { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; }

.toast { position: fixed; inset-inline: 0; bottom: 20px; margin: auto; width: fit-content; max-width: 90vw; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; z-index: 99; }

/* ---------- phone layout ---------- */
@media (max-width: 820px) {
  .rail { display: none; }
  .list-pane { flex: 1 1 100%; border: none; }
  .conv-pane { display: none; }
  .screen.app.in-chat .list-pane { display: none; }
  .screen.app.in-chat .conv-pane { display: flex; }
  .back { display: grid; }
  .mobile-only { display: grid; }
  .messages { padding: 12px; }
  .msg { max-width: 85%; }
}

.lang-btn[data-lang="en"] span { font-family: var(--num-font); font-size: 21px; }
.admin-link { display: flex; align-items: center; justify-content: center; text-decoration: none; color: var(--brand); }

/* ---------- v1.2: voice waveform ---------- */
.voice { gap: 8px; min-width: 250px; }
.wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 34px; cursor: pointer; }
.wave i { flex: 1; max-width: 4px; min-width: 2px; border-radius: 2px; background: #A9C3CD; }
.wave i.on { background: var(--brand); }
.msg.out .wave i { background: #9FBBC6; }
.msg.out .wave i.on { background: var(--brand-dark); }
.voice-side { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.speed { min-width: 38px; height: 22px; border-radius: 11px; border: none; background: rgba(6,98,135,.12); color: var(--brand-dark); font-family: var(--num-font); font-size: 11px; font-weight: 700; cursor: pointer; padding: 0 6px; }
.voice-mic { width: 16px; height: 16px; color: var(--muted); }
.voice-mic.played { color: var(--read); }
.rec-wave { flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px; height: 30px; direction: ltr; overflow: hidden; }
.rec-wave i { width: 3px; border-radius: 2px; background: var(--brand); flex: 0 0 3px; }

/* ---------- reply ---------- */
.reply-bar { background: #fff; border-top: 1px solid var(--line); padding: 8px 12px 0; display: flex; align-items: center; gap: 8px; }
.reply-quote, .quote { flex: 1; min-width: 0; border-inline-start: 4px solid var(--brand); background: var(--bg); border-radius: 8px; padding: 4px 10px; display: flex; flex-direction: column; }
.reply-quote b, .quote b { font-size: 13px; color: var(--brand); }
.reply-quote span, .quote span { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quote { background: rgba(0,0,0,.05); margin-bottom: 4px; cursor: pointer; border: none; text-align: start; font: inherit; color: inherit; width: 100%; }
.msg.flash { animation: flash 1.2s ease; }
@keyframes flash { 0%, 60% { box-shadow: 0 0 0 4px rgba(6,98,135,.35); } 100% { box-shadow: none; } }

/* ---------- reactions & message menu ---------- */
.msg { position: relative; }
.msg-more { position: absolute; top: 4px; inset-inline-end: 4px; width: 26px; height: 26px; border-radius: 13px; border: none; background: rgba(255,255,255,.9); color: var(--muted); display: none; place-items: center; cursor: pointer; padding: 0; }
.msg-more svg { width: 16px; height: 16px; }
.msg:hover .msg-more, .msg-more:focus-visible { display: grid; }
.reacts { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.react-chip { display: inline-flex; align-items: center; gap: 3px; min-height: 26px; padding: 0 8px; border-radius: 13px; border: 1px solid var(--line); background: #fff; font-size: 14px; cursor: pointer; }
.react-chip.mine { border-color: var(--brand); background: var(--brand-soft); }
.react-chip b { font-family: var(--num-font); font-size: 12px; font-weight: 600; color: var(--muted); }
.msg-menu { position: fixed; z-index: 50; background: #fff; border-radius: 16px; box-shadow: 0 8px 30px rgba(11,42,54,.22); padding: 8px; min-width: 230px; display: flex; flex-direction: column; gap: 2px; }
.react-row { display: flex; gap: 2px; justify-content: space-between; padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.react-btn { width: 40px; height: 40px; border-radius: 20px; border: none; background: transparent; font-size: 22px; cursor: pointer; line-height: 1; }
.react-btn:hover, .react-btn.mine { background: var(--brand-soft); }
.menu-item { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: none; background: transparent; border-radius: 10px; cursor: pointer; text-align: start; font-size: 16px; }
.menu-item:hover { background: var(--bg); }
.menu-item svg { width: 18px; height: 18px; color: var(--muted); }
@media (hover: none) { .msg-more { display: none !important; } }

.check { display: flex; align-items: center; gap: 10px; font-size: 16px; cursor: pointer; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--brand); }

select.cc { font-family: var(--num-font); font-weight: 600; font-size: 16px; padding: 0 10px; cursor: pointer; color: var(--ink); }
select.cc:focus { outline: none; border-color: var(--brand); }

.notif-banner { margin: 0 18px 10px; padding: 10px 12px; border-radius: 14px; background: var(--brand-soft); display: flex; align-items: center; gap: 8px; font-size: 15px; }
.notif-banner span { flex: 1; }
.notif-banner .btn { min-height: 38px; font-size: 15px; padding: 0 14px; }

.me-photo { display: flex; align-items: center; gap: 16px; margin: 6px 0 4px; }
.avatar.big { width: 88px; height: 88px; flex: 0 0 88px; border-radius: 44px; font-size: 38px; }
.me-photo-btns { display: flex; flex-direction: column; gap: 8px; }
.me-photo-btns .btn { min-height: 40px; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- v1.6: groups ---------- */
.group-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; }
.dlg-body { display: flex; flex-direction: column; gap: 10px; }
.row-flex { display: flex; gap: 8px; align-items: center; }
.row-flex .input { flex: 1; }
.pick-list, .member-list { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 14px; }
.pick-list:empty { display: none; }
.pick-list li label, .member-list li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; min-height: 52px; }
.pick-list li + li, .member-list li + li { border-top: 1px solid #EDF2F4; }
.pick-list input { width: 20px; height: 20px; accent-color: var(--brand); }
.pick-list .avatar, .member-list .avatar { width: 38px; height: 38px; flex: 0 0 38px; font-size: 17px; }
.member-list .mname { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.member-list .mname b { font-family: var(--head-font); font-size: 18px; }
.member-list .mname small { font-family: var(--num-font); color: var(--muted); font-size: 12px; }
.member-list .mact { display: flex; gap: 4px; flex-wrap: wrap; }
.member-list .mact .btn { min-height: 34px; font-size: 13px; padding: 0 10px; }
.role { padding: 1px 8px; border-radius: 9px; background: var(--brand-soft); color: var(--brand-dark); font-size: 12px; font-weight: 700; }
.ginfo-add { display: flex; flex-direction: column; gap: 8px; }
.msg.sys { align-self: center; background: rgba(255,255,255,.85); color: var(--muted); font-size: 14px; border-radius: 12px; padding: 4px 14px; max-width: 90%; text-align: center; }
.sender { font-family: var(--head-font); font-weight: 700; font-size: 15px; line-height: 1.3; }
.conv-meta.clickable { cursor: pointer; }
.minfo-sec { margin-top: 6px; }
.minfo-sec h3 { margin: 0 0 4px; font-size: 16px; display: flex; align-items: center; gap: 6px; }
.minfo-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.minfo-row .avatar { width: 34px; height: 34px; flex: 0 0 34px; font-size: 15px; }
.minfo-row time { margin-inline-start: auto; font-family: var(--num-font); font-size: 12px; color: var(--muted); }

/* ---------- v1.8: channels, files, video, edit / delete, invite links ---------- */
.chan-ic { width: 18px; height: 18px; flex: 0 0 18px; color: var(--brand); display: inline-grid; }
.chan-ic svg { width: 18px; height: 18px; }
.channel-bar { background: #fff; border-top: 1px solid var(--line); padding: 14px 16px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 15px; }
.channel-bar svg { width: 20px; height: 20px; color: var(--brand); }
.upload-bar { background: var(--brand-soft); color: var(--brand-dark); padding: 6px 16px; display: flex; align-items: center; gap: 10px; font-size: 14px; font-family: var(--num-font); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(6,98,135,.25); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.msg video.video { max-width: 100%; max-height: 380px; border-radius: 12px; background: #000; display: block; }
.file-box { display: flex; align-items: center; gap: 10px; min-width: 230px; max-width: 100%; padding: 8px; border-radius: 12px; background: rgba(0,0,0,.05); text-decoration: none; color: inherit; }
.file-box:hover { background: rgba(0,0,0,.08); }
.file-ic { position: relative; width: 42px; height: 48px; flex: 0 0 42px; display: grid; place-items: center; color: var(--brand); }
.file-ic svg { width: 42px; height: 48px; stroke-width: 1.4; }
.file-ic b { position: absolute; bottom: 9px; font-family: var(--num-font); font-size: 9px; font-weight: 700; color: var(--brand-dark); }
.file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.file-name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-size: 12px; color: var(--muted); }
.file-dl { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 17px; border: 1.5px solid var(--brand); color: var(--brand); display: grid; place-items: center; }
.file-dl svg { width: 18px; height: 18px; }

.msg.deleted .msg-text { font-style: italic; color: var(--muted); font-size: 15px; }
.msg-meta .edited { font-family: var(--body-font); font-style: italic; }
.msg-meta .views { display: inline-flex; align-items: center; gap: 3px; }
.msg-meta .views svg { width: 13px; height: 13px; }
.menu-item.danger, .menu-item.danger svg { color: var(--danger); }
.reply-bar.editing .reply-quote { border-inline-start-color: #B5652A; }
.reply-bar.editing .reply-quote b { color: #8A4A18; }

.small-dialog { width: min(360px, 92vw); }
.block-left { width: 100%; text-align: start; }
.textarea { min-height: 70px; padding: 10px 16px; resize: vertical; line-height: 1.6; }
.row-flex.wrap { flex-wrap: wrap; }
.row-flex .group-btn { flex: 1; }
.center-body { align-items: center; text-align: center; }
.center-body .row-end { width: 100%; }
.join-desc { margin: 0; white-space: pre-wrap; color: var(--ink); }
.invite-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 14px; background: var(--bg); }
.invite-url { font-size: 14px; word-break: break-all; color: var(--brand-dark); }
.invite-box .btn { min-height: 40px; font-size: 15px; padding: 0 14px; display: inline-flex; align-items: center; text-decoration: none; color: inherit; }
.invite-box .btn.danger { color: var(--danger); }
.dialog .dlg-body { max-height: 85vh; overflow-y: auto; }
.dlg-body > * { flex-shrink: 0; }

/* ---------- v1.9: calmer typography ----------
   Scheherazade New is kept only for big page titles. Names, buttons and messages use
   Noto Naskh Arabic for Pashto/Dari and Inter for English letters and numbers, at normal sizes. */
:root { --body-font: 'Inter', 'Noto Naskh Arabic', system-ui, sans-serif; }
body { font-size: 15px; line-height: 1.6; }
.conv-name, .chat-name, .btn, .lang-btn span, .step span, .sender, .member-list .mname b, .call-name { font-family: var(--body-font); }
.title { font-size: 26px; }
.h-title { font-size: 22px; line-height: 1.5; }
html[lang="en"] .title { font-size: 22px; }
html[lang="en"] .h-title { font-size: 19px; }
.list-head .h-title { font-size: 24px; }

.btn { font-size: 15px; font-weight: 600; min-height: 42px; padding: 0 16px; border-radius: 12px; }
.btn.block { font-size: 17px; min-height: 50px; }
.lang-btn { font-size: 19px; min-height: 54px; }
.label { font-size: 14px; }
.input, .phone-row input { min-height: 46px; }
.phone-row input { font-size: 16px; }
.cc { min-height: 46px; }

.chat-item { padding: 9px 16px; gap: 11px; }
.chat-name { font-size: 15.5px; font-weight: 600; line-height: 1.5; }
.chat-last { font-size: 13.5px; line-height: 1.5; }
.chat-time { font-size: 11.5px; }
.avatar { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 23px; font-size: 19px; font-family: var(--body-font); }
.avatar.big { width: 80px; height: 80px; flex: 0 0 80px; border-radius: 40px; font-size: 32px; }
.search { min-height: 40px; font-size: 14px; }

.conv-head { padding: 8px 14px; min-height: 62px; }
.conv-name { font-size: 16.5px; font-weight: 600; line-height: 1.4; }
.conv-status { font-size: 12.5px; line-height: 1.4; }
.conv-name span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.msg { padding: 5px 10px; border-radius: 14px; }
.msg-text { font-size: calc(15px * var(--msg-scale, 1)); line-height: 1.6; }
.sender { font-size: 13px; font-weight: 600; }
.msg.sys { font-size: 12.5px; }
.day { font-size: 12px; }
.quote b, .reply-quote b { font-size: 12.5px; }
.quote span, .reply-quote span { font-size: 13px; }
#msg-input { font-size: 15px; min-height: 44px; }
.send-btn { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 23px; }
.menu-item { font-size: 14.5px; min-height: 40px; }
.file-name { font-size: 14px; }
.channel-bar { font-size: 14px; }
.notif-banner { font-size: 13.5px; }
.notif-banner .btn { min-height: 34px; font-size: 13.5px; }

.member-list .mname b { font-size: 14.5px; font-weight: 600; }
.pick-list .chat-name { font-size: 14.5px; }
.member-list .mact .btn { min-height: 32px; font-size: 12.5px; }
.invite-box .btn { min-height: 36px; font-size: 13.5px; }
.me-photo-btns .btn { min-height: 36px; font-size: 14px; }
.dialog { padding: 20px; }
.join-desc { font-size: 14px; }

/* ---------- v1.9: header buttons ---------- */
.head-actions { display: flex; align-items: center; gap: 2px; }
.head-actions .icon-btn { color: var(--brand); width: 42px; height: 42px; }
.head-actions .icon-btn svg { width: 21px; height: 21px; }
#ginfo-invite.flash { animation: flash 1.2s ease; }

/* ---------- v1.9: calls ---------- */
.call-bubble { display: flex; align-items: center; gap: 8px; border: none; background: transparent; padding: 2px 0; cursor: pointer; font: inherit; font-size: 14.5px; color: inherit; text-align: start; }
.call-bubble svg { width: 18px; height: 18px; color: var(--ok); }
.call-bubble.missed svg, .call-bubble.missed { color: var(--danger); }

.call-screen { position: fixed; inset: 0; z-index: 200; background: radial-gradient(circle at 50% 30%, #0b4d68 0%, #062f40 60%, #041f2b 100%); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: max(36px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom)); overflow: hidden; }
.call-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; display: none; }
.call-screen.is-video.connected .call-remote { display: block; }
.call-screen.is-video.connected.remote-cam-off .call-remote { display: none; }
.call-screen:not(.is-video) .call-remote { display: block; position: absolute; width: 1px; height: 1px; opacity: 0; }
.call-top { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 6vh; text-align: center; }
.call-top .avatar.big { width: 112px; height: 112px; flex-basis: 112px; border-radius: 56px; font-size: 44px; box-shadow: 0 0 0 8px rgba(255,255,255,.08), 0 0 0 18px rgba(255,255,255,.04); }
.call-name { font-size: 24px; font-weight: 700; line-height: 1.3; }
.call-status { font-size: 15px; opacity: .85; }
.call-screen.is-video.connected:not(.remote-cam-off) .call-top { margin-top: 0; flex-direction: row; gap: 10px; background: rgba(0,0,0,.35); padding: 6px 14px 6px 6px; border-radius: 30px; }
.call-screen.is-video.connected:not(.remote-cam-off) .call-top .avatar.big { width: 40px; height: 40px; flex-basis: 40px; font-size: 17px; box-shadow: none; }
.call-screen.is-video.connected:not(.remote-cam-off) .call-name { font-size: 16px; }
.call-local { position: absolute; z-index: 3; width: 120px; height: 170px; object-fit: cover; border-radius: 14px; border: 2px solid rgba(255,255,255,.7); top: max(20px, env(safe-area-inset-top)); inset-inline-end: 16px; background: #222; transform: scaleX(-1); }
.call-actions { position: relative; z-index: 2; display: flex; gap: 22px; align-items: center; justify-content: center; }
.call-btn { width: 62px; height: 62px; border-radius: 31px; border: none; background: rgba(255,255,255,.16); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; position: relative; }
.call-btn svg { width: 26px; height: 26px; }
.call-btn span { position: absolute; top: 70px; font-size: 13px; white-space: nowrap; }
.call-btn.end { background: #E5383B; }
.call-btn.accept { background: #22A45D; animation: pulse 1.4s infinite; }
#call-incoming-actions { gap: 90px; margin-bottom: 30px; }
.call-btn.off { background: #fff; color: var(--ink); }
.call-btn .ic-off { display: none; }
.call-btn.off .ic-off { display: block; }
.call-btn.off .ic-on { display: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,164,93,.6); } 70% { box-shadow: 0 0 0 18px rgba(34,164,93,0); } 100% { box-shadow: 0 0 0 0 rgba(34,164,93,0); } }
@media (max-width: 820px) {
  .call-local { width: 96px; height: 136px; }
  .head-actions .icon-btn { width: 38px; height: 38px; }
}
.chat-time, .msg-meta > span:not(.edited), .call-status { direction: ltr; unicode-bidi: isolate; }

/* ---------- v1.10: side bar, filters, emoji, drag & drop, photo viewer ---------- */
.rail { gap: 6px; }
.rail-btn { position: relative; }
.rail-btn svg { width: 23px; height: 23px; }
.rail-sep { width: 32px; height: 1px; background: rgba(255,255,255,.25); margin: 4px 0; }
.rail-badge { position: absolute; top: 4px; inset-inline-end: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #25D366; color: #fff; font: 700 10.5px/18px var(--num-font); text-align: center; }
.rail-me { width: 44px; height: 44px; border-radius: 22px; border: 2px solid rgba(255,255,255,.7); padding: 0; background: none; cursor: pointer; margin-top: 4px; overflow: hidden; }
.rail-me .avatar { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 20px; font-size: 16px; }
.rail-me:hover { border-color: #fff; }

.chips { display: flex; gap: 6px; padding: 0 16px 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; min-height: 32px; padding: 0 14px; border-radius: 16px; border: 1px solid var(--line); background: #fff; color: var(--muted); font: 600 13.5px var(--body-font); cursor: pointer; }
.chip:hover { background: var(--bg); }
.chip.active { background: var(--brand-soft); border-color: var(--brand-soft); color: var(--brand-dark); }
.chat-list li.empty { padding: 30px 20px; text-align: center; font-size: 14px; }

.conv { position: relative; }
.emoji-panel { position: absolute; bottom: 70px; inset-inline-start: 12px; z-index: 20; width: min(340px, calc(100% - 24px)); max-height: 240px; overflow-y: auto; background: #fff; border-radius: 16px; box-shadow: 0 8px 30px rgba(11,42,54,.2); padding: 8px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emo { border: none; background: none; font-size: 23px; line-height: 1; padding: 6px 0; border-radius: 8px; cursor: pointer; }
.emo:hover { background: var(--bg); }
.composer .icon-btn { flex: 0 0 44px; }

.drop-overlay { position: absolute; inset: 0; z-index: 30; background: rgba(227,241,246,.92); border: 3px dashed var(--brand); border-radius: 12px; margin: 8px; display: grid; place-items: center; pointer-events: none; }
.drop-overlay div { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--brand-dark); font-size: 18px; font-weight: 600; }
.drop-overlay svg { width: 48px; height: 48px; }

.send-dialog { width: min(480px, 94vw); }
.send-preview { display: grid; place-items: center; background: var(--bg); border-radius: 14px; min-height: 120px; max-height: 50vh; overflow: hidden; padding: 8px; }
.send-media { max-width: 100%; max-height: calc(50vh - 16px); border-radius: 10px; display: block; }
.send-preview .file-box { width: 100%; }

.lightbox { position: fixed; inset: 0; z-index: 150; background: rgba(4,20,28,.94); display: grid; place-items: center; padding: 56px 12px 12px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lightbox-bar { position: absolute; top: 8px; inset-inline-end: 8px; display: flex; gap: 6px; }
.lightbox-bar .icon-btn { color: #fff; background: rgba(255,255,255,.12); }
.msg img.photo { cursor: zoom-in; }
@media (max-width: 820px) {
  .chips { padding: 0 12px 8px; }
  .emoji-panel { grid-template-columns: repeat(7, 1fr); }
}
/* the send arrow was flipped outside its box in right-to-left languages (invisible) */
html[dir="rtl"] .send-btn svg path[d^="M22 2"], html[dir="rtl"] #rec-send svg { transform: none; }
html[dir="rtl"] .send-btn .ic-send, html[dir="rtl"] #rec-send svg { transform: scaleX(-1); }

/* ---------- v1.10.1: clear recording state ---------- */
.recorder { background: #FFF4F4; border-top-color: #F3C9C9; }
.rec-label { display: inline-flex; align-items: center; gap: 8px; color: var(--danger); font-weight: 600; font-size: 14.5px; white-space: nowrap; }
.rec-label bdi { font-family: var(--num-font); font-weight: 700; color: var(--ink); min-width: 38px; }
.rec-dot { width: 11px; height: 11px; border-radius: 6px; }
.rec-cancel { color: var(--danger); }
.rec-wave i { background: var(--danger); opacity: .75; }
#rec-send, #rec-send:hover { background: var(--ok); box-shadow: 0 0 0 0 rgba(31,122,77,.5); animation: recpulse 1.6s infinite; }
@keyframes recpulse { 0% { box-shadow: 0 0 0 0 rgba(31,122,77,.45); } 70% { box-shadow: 0 0 0 12px rgba(31,122,77,0); } 100% { box-shadow: 0 0 0 0 rgba(31,122,77,0); } }
.send-btn { transition: background .15s; }
.send-btn:hover { background: var(--brand-dark); }
.send-btn.busy svg { display: none !important; }
.send-btn.busy::after { content: ''; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .8s linear infinite; }

/* ---------- v1.11: forward, pin / mute / archive, search in chat, jump ---------- */
.fwd-label { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; font-style: italic; }
.fwd-label svg { width: 13px; height: 13px; }
.fwd-preview { background: var(--bg); border-radius: 10px; padding: 8px 12px; font-size: 14px; color: var(--muted); border-inline-start: 4px solid var(--brand); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fwd-search { margin: 0; }
.fwd-list { max-height: 46vh; }
.list-ic { width: 16px; height: 16px; color: #8A9AA2; display: inline-grid; flex: 0 0 16px; }
.list-ic svg { width: 16px; height: 16px; }
.badge.muted { background: #A9B6BC; }
.archive-row { width: 100%; display: flex; align-items: center; gap: 14px; padding: 10px 26px; border: none; background: none; cursor: pointer; font: 600 15px var(--body-font); color: var(--ink); text-align: start; }
.archive-row:hover { background: var(--bg); }
.archive-row svg { width: 20px; height: 20px; color: var(--brand); }
.archive-row.back { color: var(--brand); border-bottom: 1px solid var(--line); }
html[dir="ltr"] .archive-row.back svg { transform: scaleX(-1); }
.archive-n { font-size: 12.5px; color: var(--brand); font-weight: 700; }

.conv-search { position: relative; background: #fff; border-bottom: 1px solid var(--line); padding: 6px 10px; display: flex; align-items: center; gap: 6px; z-index: 15; }
.conv-search .search { flex: 1; margin: 0; }
.search-results { position: absolute; top: 100%; inset-inline: 0; max-height: 55vh; overflow-y: auto; background: #fff; list-style: none; margin: 0; padding: 4px 0; box-shadow: 0 10px 24px rgba(11,42,54,.15); }
.sr-item { width: 100%; border: none; background: none; text-align: start; padding: 8px 16px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; font: inherit; color: inherit; }
.sr-item:hover { background: var(--bg); }
.sr-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--brand-dark); }
.sr-head time { color: var(--muted); }
.sr-body { font-size: 14px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-body mark { background: #FFE58A; border-radius: 3px; padding: 0 1px; }
.sr-empty { padding: 14px 16px; }
.to-bottom { position: absolute; bottom: 84px; inset-inline-start: 18px; z-index: 12; width: 42px; height: 42px; border-radius: 21px; border: none; background: #fff; color: var(--brand); box-shadow: 0 3px 12px rgba(11,42,54,.2); display: grid; place-items: center; cursor: pointer; }
.to-bottom b { position: absolute; top: -6px; inset-inline-end: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #25D366; color: #fff; font: 700 11px/20px var(--num-font); }

/* ---------- v1.11: settings screen ---------- */
.settings-dialog { width: min(520px, 96vw); padding: 0; max-height: 92vh; overflow: hidden; }
.settings-dialog form { display: flex; flex-direction: column; gap: 0; max-height: 92vh; }
.set-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 8px; }
.set-scroll { overflow-y: auto; padding: 4px 18px 10px; display: flex; flex-direction: column; gap: 14px; flex: 1; background: var(--bg); padding-top: 14px; }
.set-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: #fff; }
.settings-dialog .error { padding: 0 18px; }
.set-card { background: #fff; border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; border: 1px solid #E6EDF0; }
.set-sec { display: flex; flex-direction: column; gap: 6px; }
.set-h { margin: 0 4px; font-size: 12.5px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .02em; }
.set-label { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.profile-card { flex-direction: row; align-items: center; gap: 16px; padding: 16px; background: linear-gradient(135deg, #066287 0%, #0B7FA8 100%); color: #fff; border: none; }
.profile-card .avatar.big { border: 3px solid rgba(255,255,255,.85); }
.avatar-edit { position: relative; cursor: pointer; flex: 0 0 auto; }
.avatar-edit .cam { position: absolute; bottom: 0; inset-inline-end: 0; width: 30px; height: 30px; border-radius: 15px; background: #fff; color: var(--brand); display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.avatar-edit .cam svg { width: 16px; height: 16px; }
.pc-info { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.pc-name { font-size: 19px; font-weight: 700; line-height: 1.3; }
.pc-phone { font-size: 13.5px; opacity: .9; }
.pc-tick { display: flex; align-items: center; gap: 6px; font-size: 12.5px; background: rgba(255,255,255,.15); padding: 2px 10px; border-radius: 10px; margin-top: 4px; }
.pc-tick .muted { color: #E3F1F6; }
.pc-tick .verified { background: #fff; border-radius: 50%; }
.profile-card .link { color: #fff; opacity: .85; min-height: 0; padding: 2px 0; font-size: 12.5px; text-decoration: underline; }
.set-row { display: flex; align-items: center; gap: 12px; min-height: 52px; cursor: pointer; text-decoration: none; color: inherit; border: none; background: none; font: inherit; text-align: start; width: 100%; }
.set-card.set-row { flex-direction: row; padding: 10px 14px; }
.set-card > .set-row + .set-row { border-top: 1px solid #EDF2F4; }
.set-row b { display: block; font-size: 14.5px; font-weight: 600; }
.set-row small { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.set-ic { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.set-ic svg { width: 19px; height: 19px; }
.small-btn { min-height: 34px; font-size: 13.5px; padding: 0 12px; }
.chev { width: 18px; height: 18px; color: var(--muted); }
html[dir="rtl"] .chev { transform: scaleX(-1); }
.logout-row b { color: var(--danger); }
.logout-row .set-ic { background: #FDECEA; color: var(--danger); }
.admin-row .set-ic { background: #EFE7FA; color: #5B2E99; }
.set-ver { text-align: center; margin: 2px 0 6px; font-size: 11.5px; }

.switch { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; border-radius: 13px; background: #C9D5DA; position: relative; cursor: pointer; flex: 0 0 44px; transition: background .2s; margin: 0; }
.switch::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: inset-inline-start .2s; }
.switch:checked { background: var(--ok); }
.switch:checked::after { inset-inline-start: 21px; }
.switch:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--bg); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: none; background: transparent; min-height: 40px; border-radius: 9px; font: 600 15px var(--body-font); color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--brand-dark); box-shadow: 0 1px 4px rgba(11,42,54,.12); }

.dev-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.dev-list li { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.dev-list li + li { border-top: 1px solid #EDF2F4; }
.dev-list b { display: block; font-size: 14px; font-weight: 600; }
.dev-list small { display: block; font-size: 12px; color: var(--muted); }
.dev-cur { color: var(--ok); font-size: 12px; }
.dev-list li.cur .set-ic { background: #DFF3E8; color: var(--ok); }
#logout-others { min-height: 40px; font-size: 14px; }
@media (max-width: 820px) {
  .settings-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  .settings-dialog form { max-height: 100dvh; height: 100%; }
}
.set-card.set-row { background: #fff; border: 1px solid #E6EDF0; border-radius: 16px; }

/* ---------- v1.12: wallet ---------- */
.ic-wallet { background: #E7F5EC; color: var(--ok); }
.ic-tick { background: var(--brand-soft); color: var(--brand); }
.wallet-dialog { width: min(440px, 94vw); }
.w-balance { border-radius: 18px; padding: 18px 20px; color: #fff; background: linear-gradient(135deg, #0B6E4F 0%, #1F9D6A 100%); display: flex; flex-direction: column; gap: 2px; position: relative; overflow: hidden; }
.w-balance::after { content: ''; position: absolute; width: 160px; height: 160px; border-radius: 50%; background: rgba(255,255,255,.08); inset-inline-end: -50px; top: -60px; }
.w-balance small { opacity: .9; font-size: 13px; }
.w-balance div { font-family: var(--num-font); font-size: 15px; }
.w-balance b { font-size: 36px; font-weight: 700; line-height: 1.2; }
.w-redeem { display: flex; flex-direction: column; gap: 6px; }
.w-redeem .input { font-size: 18px; letter-spacing: 2px; text-align: center; font-family: var(--num-font); }
.w-buy { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; border-radius: 12px; background: #E9F9EF; color: #128C4A; text-decoration: none; font-weight: 600; font-size: 14px; }
.w-buy svg { width: 18px; height: 18px; }
.w-history { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
.w-history li { display: flex; align-items: center; gap: 10px; padding: 8px 2px; }
.w-history li + li { border-top: 1px solid #EDF2F4; }
.w-history b { display: block; font-size: 14px; font-weight: 600; }
.w-history small { display: block; font-size: 11.5px; color: var(--muted); }
.w-ic { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%; display: grid; place-items: center; font: 700 15px var(--num-font); }
.w-ic.in { background: #E7F5EC; color: var(--ok); }
.w-ic.out { background: var(--brand-soft); color: var(--brand); }
.w-amt { font: 700 15px var(--num-font); }
.w-amt.in { color: var(--ok); }
.w-amt.out { color: var(--ink); }

/* ---------- v1.12: dark mode ---------- */
html[data-theme="dark"] {
  color-scheme: dark;
  --brand-soft: #123847; --ink: #E4ECEF; --muted: #93A5AD; --line: #2A3A43; --bg: #111C22; --chat-bg: #0B1419;
  --out: #0B4A62; --in: #1A2830; --read: #4FB3F6; --ok: #3CC27F; --danger: #FF6B5E; --surface: #16232A; --surface2: #1D2C34;
}
html[data-theme="dark"] body { background: var(--bg); color: var(--ink); }
html[data-theme="dark"] :is(.card, .lang-btn, .btn, .list-pane, .conv-head, .composer, .reply-bar, .msg-menu, .channel-bar, .chip,
  .emoji-panel, .conv-search, .search-results, .to-bottom, .set-foot, .set-card, .set-card.set-row, .seg button.on, .dialog, .react-chip,
  .found, .send-preview, .upload-bar, .fwd-preview) { background: var(--surface); color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] .recorder { background: #2A1A1C; border-color: #4A2A2C; }
html[data-theme="dark"] :is(.input, .phone-row input, .code-input, #msg-input, .search, select.cc, .cc) { background: var(--surface2); color: var(--ink); border-color: #34464F; }
html[data-theme="dark"] .search { border-color: transparent; }
html[data-theme="dark"] :is(.set-scroll, .seg, .pick-list, .member-list, .invite-box, .file-box, .quote, .reply-quote, .w-history, .send-preview) { background-color: var(--bg); }
html[data-theme="dark"] .file-box { background: rgba(255,255,255,.06); }
html[data-theme="dark"] .quote { background: rgba(255,255,255,.07); }
html[data-theme="dark"] .day, html[data-theme="dark"] .msg.sys { background: #1D2C34; color: var(--muted); }
html[data-theme="dark"] .msg-more { background: rgba(29,44,52,.95); color: var(--muted); }
html[data-theme="dark"] .chat-item:hover, html[data-theme="dark"] .sr-item:hover, html[data-theme="dark"] .menu-item:hover,
html[data-theme="dark"] .archive-row:hover, html[data-theme="dark"] .icon-btn:hover, html[data-theme="dark"] .emo:hover { background: var(--surface2); }
html[data-theme="dark"] .chat-item.active { background: #15333F; }
html[data-theme="dark"] .rail { background: #0D2A36; }
html[data-theme="dark"] .msg.out .wave i { background: #4F7F92; }
html[data-theme="dark"] .msg.out .wave i.on, html[data-theme="dark"] .wave i.on { background: #7FD0F0; }
html[data-theme="dark"] .wave i { background: #3D5560; }
html[data-theme="dark"] .speed { background: rgba(127,208,240,.15); color: #A8DDF2; }
html[data-theme="dark"] .msg-meta, html[data-theme="dark"] .tick.sent, html[data-theme="dark"] .tick.delivered { color: #8FA3AB; stroke: #8FA3AB; }
html[data-theme="dark"] .sr-body mark { background: #7A6420; color: #fff; }
html[data-theme="dark"] .chip.active { background: var(--brand-soft); color: #A8DDF2; border-color: var(--brand-soft); }
html[data-theme="dark"] .btn.primary, html[data-theme="dark"] .send-btn, html[data-theme="dark"] .round-btn { background: #0A7AA6; border-color: #0A7AA6; color: #fff; }
html[data-theme="dark"] .set-ic { background: #15333F; color: #7FD0F0; }
html[data-theme="dark"] .pick-list li + li, html[data-theme="dark"] .member-list li + li, html[data-theme="dark"] .w-history li + li,
html[data-theme="dark"] .dev-list li + li, html[data-theme="dark"] .set-card > .set-row + .set-row { border-color: var(--line); }
html[data-theme="dark"] .dialog::backdrop { background: rgba(0,0,0,.6); }
html[data-theme="dark"] .toast { background: #E4ECEF; color: #0B1419; }
html[data-theme="dark"] .notif-banner { background: #15333F; }
html[data-theme="dark"] .w-buy { background: #143A2A; color: #6FE0A4; }
html[data-theme="dark"] .drop-overlay { background: rgba(17,28,34,.92); }
html[data-theme="dark"] .conv-empty img, html[data-theme="dark"] .logo-big, html[data-theme="dark"] .logo-mid { filter: brightness(1.6) saturate(.8); }
html[data-theme="dark"] .switch { background: #3A4C55; }
html[data-theme="dark"] .badge.muted { background: #4A5A61; }
html[data-theme="dark"] .msg.deleted .msg-text { color: #7F949C; }

/* ---------- v1.12: chat background pattern ---------- */
html[data-wall="on"] .messages {
  background-color: var(--chat-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23066287' stroke-opacity='.055' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 18h20a4 4 0 0 1 4 4v10a4 4 0 0 1-4 4H22l-6 5v-5h-2a4 4 0 0 1-4-4V22a4 4 0 0 1 4-4z'/%3E%3Ccircle cx='86' cy='26' r='9'/%3E%3Cpath d='M82 26l3 3 5-6'/%3E%3Cpath d='M70 76l6-10 6 10M73 72h6'/%3E%3Cpath d='M24 84c0-6 8-6 8 0s8 6 8 0'/%3E%3Cpath d='M98 82a8 8 0 1 1-8-8'/%3E%3Cpath d='M46 52l4 4 4-4M50 46v10'/%3E%3Cpath d='M104 104l6-6M104 98l6 6'/%3E%3Cpath d='M16 104h10M21 99v10'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 160px 160px;
}
html[data-theme="dark"][data-wall="on"] .messages {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%237FD0F0' stroke-opacity='.035' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 18h20a4 4 0 0 1 4 4v10a4 4 0 0 1-4 4H22l-6 5v-5h-2a4 4 0 0 1-4-4V22a4 4 0 0 1 4-4z'/%3E%3Ccircle cx='86' cy='26' r='9'/%3E%3Cpath d='M82 26l3 3 5-6'/%3E%3Cpath d='M70 76l6-10 6 10M73 72h6'/%3E%3Cpath d='M24 84c0-6 8-6 8 0s8 6 8 0'/%3E%3Cpath d='M98 82a8 8 0 1 1-8-8'/%3E%3Cpath d='M46 52l4 4 4-4M50 46v10'/%3E%3Cpath d='M104 104l6-6M104 98l6 6'/%3E%3Cpath d='M16 104h10M21 99v10'/%3E%3C/g%3E%3C/svg%3E");
}
.seg3 button { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 14px; }
html[data-theme="dark"] .switch:checked { background: var(--ok); }
html[data-theme="dark"] .dev-list li.cur .set-ic, html[data-theme="dark"] .ic-wallet { background: #143A2A; color: #6FE0A4; }

/* ---------- v1.13: code could not be sent ---------- */
.code-note { background: #FFF4E5; color: #7A4300; border-radius: 14px; padding: 12px 14px; font-size: 14px; line-height: 1.6; display: flex; flex-direction: column; gap: 10px; text-align: start; }
.wa-btn { background: #25D366; border-color: #25D366; color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; font-size: 15px; min-height: 46px; }
.wa-btn svg { width: 20px; height: 20px; }
html[data-theme="dark"] .code-note { background: #3A2A12; color: #F5C88A; }
.have-code { align-self: center; font-weight: 600; text-decoration: underline; }

/* ---------- v1.14: attachment menu, location, contact ---------- */
.attach-menu { position: absolute; bottom: 70px; inset-inline-start: 12px; z-index: 22; background: #fff; border-radius: 16px; box-shadow: 0 8px 30px rgba(11,42,54,.22); padding: 8px; display: flex; flex-direction: column; min-width: 210px; }
.attach-menu button { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border: none; background: none; border-radius: 10px; font: 500 15px var(--body-font); color: var(--ink); cursor: pointer; text-align: start; }
.attach-menu button:hover { background: var(--bg); }
.am-ic { width: 36px; height: 36px; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; flex: 0 0 36px; }
.am-ic svg { width: 19px; height: 19px; }
html[data-theme="dark"] .attach-menu { background: var(--surface); }
html[data-theme="dark"] .attach-menu button { color: var(--ink); }

.loc-map { position: relative; overflow: hidden; border-radius: 10px; background: #E8EEF0; direction: ltr; }
.loc-map img { position: absolute; width: 256px; height: 256px; max-width: none; pointer-events: none; }
.loc-map.big { width: 100%; height: 200px; display: grid; place-items: center; }
.loc-wait { color: var(--muted); font-size: 14px; }
.loc-pin { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; transform: translate(-50%, -92%); color: #E5383B; filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); }
.loc-pin svg { width: 34px; height: 34px; fill: #E5383B; stroke: #fff; stroke-width: 1.5; }
.loc-pin svg circle { fill: #fff; stroke: none; }
.loc-attr { position: absolute; bottom: 2px; right: 4px; font: 9px var(--num-font); color: #333; background: rgba(255,255,255,.75); padding: 0 3px; border-radius: 3px; }
.loc-box { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; max-width: 100%; }
.loc-box .loc-map { max-width: 100%; }
.loc-cap { display: flex; flex-direction: column; padding: 0 2px; }
.loc-cap b { font-size: 14px; font-weight: 600; }
.loc-cap small { font-size: 12px; color: var(--brand); }
.ct-box { min-width: 220px; display: flex; flex-direction: column; gap: 8px; }
.ct-top { display: flex; align-items: center; gap: 10px; }
.ct-top b { display: block; font-size: 15px; }
.ct-top small { display: block; font-size: 12.5px; color: var(--muted); }
.ct-btn { border: none; border-top: 1px solid rgba(0,0,0,.08); background: none; color: var(--brand); font: 600 14px var(--body-font); padding: 8px 0 2px; cursor: pointer; }
.ct-pick { width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 4px; border: none; background: none; cursor: pointer; text-align: start; font: inherit; color: inherit; border-radius: 10px; }
.ct-pick:hover { background: var(--bg); }
#ct-list { max-height: 50vh; }

/* ---------- v1.14: chat during a call ---------- */
.call-min { position: absolute; z-index: 4; top: max(18px, env(safe-area-inset-top)); inset-inline-start: 14px; width: 42px; height: 42px; border-radius: 21px; border: none; background: rgba(255,255,255,.16); color: #fff; display: grid; place-items: center; cursor: pointer; }
.call-min svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.call-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 210; height: calc(36px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); border: none; background: #22A45D; color: #fff; display: flex; align-items: center; justify-content: center; gap: 10px; font: 600 14px var(--body-font); cursor: pointer; }
.call-bar svg { width: 16px; height: 16px; fill: currentColor; }
html.has-callbar .screen.app { margin-top: calc(36px + env(safe-area-inset-top)); height: calc(100dvh - 36px - env(safe-area-inset-top)); }
/* voice call: the screen goes away but the sound keeps playing */
.call-screen.mini:not(.is-video) { visibility: hidden; pointer-events: none; }
/* video call: small floating window, tap to go back */
.call-screen.is-video.mini { inset: auto; bottom: 88px; inset-inline-end: 12px; width: 112px; height: 158px; padding: 0; border-radius: 14px; box-shadow: 0 8px 26px rgba(0,0,0,.35); cursor: pointer; justify-content: center; }
.call-screen.is-video.mini > :not(.call-remote):not(.call-top) { display: none !important; }
.call-screen.is-video.mini .call-top { margin: 0; gap: 4px; background: none !important; padding: 0 !important; flex-direction: column !important; }
.call-screen.is-video.mini .call-top .avatar.big { width: 52px; height: 52px; flex-basis: 52px; font-size: 22px; box-shadow: none; }
.call-screen.is-video.mini .call-name { font-size: 12px; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-screen.is-video.mini .call-status { font-size: 11px; }
.call-screen.is-video.mini.connected:not(.remote-cam-off) .call-top { display: none; }

/* ---------- v1.16: legal links, delete account ---------- */
.legal-note { margin-top: 6px; line-height: 1.6; }
.legal-note a { color: var(--brand); font-weight: 600; text-decoration: none; }
.legal-links { padding: 0; overflow: hidden; }
.legal-links .set-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; color: inherit; text-decoration: none; font-size: 14.5px; }
.legal-links .set-row + .set-row { border-top: 1px solid var(--line, rgba(0,0,0,.08)); }
.delete-row b { color: var(--danger); }
.delete-row .set-ic { background: #FDECEA; color: var(--danger); }
.del-list { margin: 8px 0 12px; padding-inline-start: 20px; line-height: 1.8; }
.del-bal { background: #FFF4E5; color: #8A5A00; padding: 8px 12px; border-radius: 10px; }

/* v1.17 – my QR code, scanner, invite link */
.pc-qr { margin-inline-start: auto; flex: 0 0 auto; width: 44px; height: 44px; border-radius: 22px; border: none; background: rgba(255,255,255,.18); color: #fff; display: grid; place-items: center; cursor: pointer; }
.pc-qr:hover, .pc-qr:focus-visible { background: rgba(255,255,255,.3); }
.pc-qr svg, .qr-row svg, .qr-actions svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.qr-row { margin-bottom: 8px; }
.qr-box { width: min(240px, 70vw); aspect-ratio: 1; margin: 6px auto; padding: 8px; background: #fff; border-radius: 18px; border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); }
.qr-box svg { width: 100%; height: 100%; display: block; stroke: none !important; }
.qr-box svg path { fill: #066287 !important; stroke: none !important; }
.qr-box svg rect { fill: #fff !important; stroke: none !important; }
.qr-link { font-family: var(--num-font); font-size: 13.5px; color: var(--brand); background: var(--brand-soft); padding: 4px 12px; border-radius: 10px; word-break: break-all; }
.qr-actions { width: 100%; margin-top: 8px; }
.qr-actions .group-btn { min-width: 120px; }
#myqr-name .verified, #person-name .verified { margin-inline-start: 4px; }
.scan-view { position: relative; width: min(300px, 80vw); aspect-ratio: 1; border-radius: 18px; overflow: hidden; background: #000; margin: 6px auto; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 18%; border: 3px solid rgba(255,255,255,.9); border-radius: 16px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
html[data-theme="dark"] .qr-link { background: rgba(6,98,135,.25); color: #8FD3EC; }

/* v1.19 – phone contacts on Tamas */
.contacts-allow { width: 100%; margin: 4px 0 8px; }
.contacts-box { margin: 6px 0 10px; border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.contacts-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.contacts-search { width: 100%; box-sizing: border-box; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-soft, rgba(0,0,0,.03)); color: inherit; font: inherit; margin-bottom: 6px; }
.contacts-list { max-height: 42vh; overflow-y: auto; }
.contact-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 4px; border: 0; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; border-radius: 10px; }
.contact-row:hover, .contact-row:focus-visible { background: var(--brand-soft, rgba(6,98,135,.08)); }
.contact-row.invite { cursor: default; }
.contact-row .avatar { flex: 0 0 auto; width: 40px; height: 40px; font-size: 16px; }
.contact-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.contact-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contacts-sub-head { font-size: 13px; font-weight: 700; color: var(--muted); margin: 12px 4px 4px; }
.contact-row .small-btn { padding: 6px 14px; font-size: 13px; flex: 0 0 auto; }
.contacts-icon { font-size: 44px; line-height: 1; margin-bottom: 4px; }

/* ---------- v1.20: phone fit (no sideways moving / zoom), profile photo in list header ---------- */
html, body { overflow-x: hidden; overscroll-behavior: none; touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.screen.app, .list-pane, .conv-pane { max-width: 100vw; overflow-x: hidden; }
.messages { overflow-x: hidden; }
.msg { min-width: 0; }
.list-me { width: 38px; height: 38px; border-radius: 19px; border: 2px solid var(--brand); padding: 0; background: none; cursor: pointer; overflow: hidden; flex: 0 0 38px; place-items: center; }
.list-me .avatar { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 17px; font-size: 15px; }
@media (max-width: 820px) {
  /* iPhone zooms into any box with text smaller than 16px when it is tapped, and the page then stays zoomed */
  input, textarea, select, #msg-input, .search { font-size: 16px; }
  .voice { min-width: 0; width: min(250px, 64vw); }
  .file-box { min-width: 0; }
  .msg-menu { min-width: 0; max-width: calc(100vw - 24px); }
  .messages img, .messages video { max-width: 100%; height: auto; }
  .loc-map { max-width: 100%; }
}

/* ---------- v1.20.1: drag along the voice wave ---------- */
.wave { position: relative; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.wave-dot { position: absolute; top: 50%; left: 0; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 7px; background: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,.25); pointer-events: none; transition: transform .1s; }
.msg.out .wave-dot { background: var(--brand-dark); }
.wave.dragging .wave-dot { transform: scale(1.35); }
html[data-theme="dark"] .wave-dot { background: #7FD0F0; }

/* ---------- v1.20.3: the wave takes the whole finger touch (iPhone) and has a bigger touch area ---------- */
.wave { touch-action: none; -webkit-touch-callout: none; padding: 10px 0; margin: -10px 0; box-sizing: content-box; }
.voice { -webkit-user-select: none; user-select: none; }

/* v1.22: "Waiting for network…" as plain text, like WhatsApp (no coloured bar) */
.net-note { font-size: 12.5px; color: var(--muted); margin-top: 1px; font-weight: 400; }
.net-note[hidden] { display: none; }
.tick.pending { stroke: var(--muted); }

/* v1.22: links and link preview cards (like WhatsApp) */
.msg-link { color: var(--brand); text-decoration: underline; word-break: break-all; }
html[data-theme="dark"] .msg-link { color: #7CC7E3; }
.link-card { display: block; margin: 2px 0 6px; border-radius: 10px; overflow: hidden; background: rgba(0,0,0,.05);
  border-inline-start: 3px solid var(--brand); text-decoration: none; color: inherit; max-width: 360px; }
html[data-theme="dark"] .link-card { background: rgba(255,255,255,.07); }
.link-img { display: block; width: 100%; max-height: 200px; object-fit: cover; background: rgba(0,0,0,.08); }
.link-info { padding: 7px 10px 8px; direction: auto; }
.link-title { font-weight: 700; font-size: 14px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.link-desc { font-size: 13px; line-height: 1.45; color: var(--muted); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.link-site { font-size: 12px; color: var(--muted); margin-top: 3px; direction: ltr; text-align: start; }

/* ---------- v1.23: prayer times (د لمانځه وختونه) ---------- */
.prayer-pill { display: inline-flex; align-items: center; gap: 6px; border: none; border-radius: 999px; background: var(--brand-soft); color: var(--brand); padding: 6px 12px; min-height: 36px; font: 700 13.5px var(--body-font); cursor: pointer; margin-inline-end: 4px; }
.prayer-pill svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.prayer-pill[hidden] { display: none; }
.prayer-dialog { width: min(480px, 96vw); padding: 0; max-height: 94vh; overflow: hidden; background: var(--bg); }
.prayer-dialog[open] { display: flex; flex-direction: column; }
.pr-view { display: flex; flex-direction: column; min-height: 0; max-height: 94vh; overflow-y: auto; }
.pr-view[hidden] { display: none; }
.pr-hero { position: relative; background: var(--brand); color: #fff; padding: 14px 18px 22px; border-radius: 0 0 30px 30px; text-align: center; overflow: hidden; flex: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34' height='34'%3E%3Cpath d='M17 7 L20 14 L27 17 L20 20 L17 27 L14 20 L7 17 L14 14 Z' fill='none' stroke='%23ffffff' stroke-opacity='0.09'/%3E%3C/svg%3E"); }
.pr-top { display: flex; align-items: center; justify-content: space-between; }
.pr-title { margin: 0; font-family: var(--head-font, inherit); font-size: 24px; font-weight: 700; }
.pr-title.dark { color: var(--ink); }
.pr-round { width: 44px; height: 44px; border-radius: 22px; border: none; background: rgba(255,255,255,.14); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.pr-round.light { background: var(--brand-soft); color: var(--ink); }
.pr-round svg, .pr-city svg, .pr-row .pr-ic svg, .pr-bell svg, .pr-search svg, .pr-nearest svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pr-city { margin: 12px auto 0; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28); color: #fff; border-radius: 999px; padding: 4px 16px; font: 600 15px var(--body-font); cursor: pointer; }
.pr-city svg { width: 17px; height: 17px; }
.pr-next-l { margin: 16px 0 0; font-size: 14px; opacity: .88; }
.pr-next { margin: 0; font-family: var(--head-font, inherit); font-size: 40px; font-weight: 700; line-height: 1.25; }
.pr-count { margin: 0; font: 700 32px var(--num-font, sans-serif); color: #F5B841; letter-spacing: 1px; direction: ltr; }
.pr-at { margin: 2px 0 0; font-size: 13.5px; opacity: .88; }
.pr-dates { margin-top: 14px; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; font-size: 12.5px; }
.pr-dates span { background: rgba(255,255,255,.13); border-radius: 999px; padding: 3px 12px; }
.pr-dates span:empty { display: none; }
.pr-body { padding: 14px 14px 18px; display: flex; flex-direction: column; gap: 8px; }
.pr-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pr-row { display: flex; align-items: center; gap: 12px; background: #fff; border: 2px solid transparent; border-radius: 18px; padding: 6px 8px 6px 14px; }
.pr-row .pr-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.pr-row .pr-n { flex: 1; display: flex; flex-direction: column; font-size: 16.5px; font-weight: 600; }
.pr-row .pr-n small { font-size: 12px; font-weight: 600; color: #8A6512; }
.pr-row .pr-t { font: 600 18px var(--num-font, sans-serif); direction: ltr; }
.pr-row.past { color: var(--muted); }
.pr-row.next { background: #FFF6E0; border-color: #F5B841; }
.pr-row.next .pr-ic { background: #F5B841; color: #1B2A30; }
.pr-row.next .pr-t { font-weight: 700; font-size: 19px; }
.pr-bell { width: 44px; height: 44px; border: none; background: transparent; color: #9AA9B0; display: grid; place-items: center; cursor: pointer; border-radius: 22px; flex: none; }
.pr-bell.on { color: var(--brand); }
.pr-bell svg { width: 20px; height: 20px; }
.pr-bell-sp { width: 44px; flex: none; }
.pr-hint { margin: 2px 4px; font-size: 13px; color: var(--muted); text-align: center; }
.pr-qibla { margin-top: 6px; display: flex; align-items: center; gap: 14px; background: #fff; border-radius: 18px; padding: 10px 14px; }
.pr-dial { width: 58px; height: 58px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; }
.pr-dial svg { width: 56px; height: 56px; }
#pr-needle { transition: transform .3s ease; transform-origin: 29px 29px; }
.pr-n1 { fill: var(--brand); } .pr-n2 { fill: #C9D7DE; } .pr-N { font: 600 7px sans-serif; fill: var(--muted); }
.pr-q-txt { flex: 1; display: flex; flex-direction: column; } .pr-q-txt b { font-size: 16px; } .pr-q-txt small { font-size: 13px; color: var(--muted); }
.pr-compass { border: 1px solid var(--line); background: transparent; color: var(--brand); border-radius: 999px; padding: 8px 14px; min-height: 40px; font: 700 13.5px var(--body-font); cursor: pointer; }
.pr-compass.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.pr-bar { display: flex; align-items: center; gap: 10px; padding: 12px 14px 4px; position: sticky; top: 0; background: var(--bg); z-index: 1; }
.pr-search { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; height: 48px; color: var(--muted); }
.pr-search input { flex: 1; border: none; background: transparent; font: 16px var(--body-font); color: var(--ink); outline: none; min-width: 0; }
.pr-nearest { display: flex; align-items: center; gap: 12px; border: 1.5px dashed #9CC0CF; background: var(--brand-soft); border-radius: 16px; padding: 10px 14px; text-align: start; font: inherit; color: var(--ink); cursor: pointer; }
.pr-nearest .pr-ni { width: 40px; height: 40px; border-radius: 12px; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.pr-nearest .grow { display: flex; flex-direction: column; gap: 2px; }
.pr-nearest b { font-size: 15.5px; }
.pr-nearest small { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); }
.pr-nearest small svg { width: 14px; height: 14px; color: #1F8A5B; flex: none; }
.pr-city-list { display: flex; flex-direction: column; background: #fff; border-radius: 16px; padding: 0 12px; }
.pr-group { margin: 12px 2px 2px; font-size: 13px; font-weight: 700; color: var(--brand); }
.pr-c { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 50px; border: none; border-bottom: 1px solid var(--line); background: transparent; padding: 4px 2px; text-align: start; font: 500 16px var(--body-font); color: var(--ink); cursor: pointer; }
.pr-c:last-child { border-bottom: none; }
.pr-c small { color: var(--muted); font-size: 12.5px; }
.pr-c .grow { display: flex; flex-direction: column; }
.pr-c.sel { font-weight: 700; color: var(--brand); }
.pr-c .pr-tick { width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.pr-c .pr-tick svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
#pr-asr { grid-template-columns: repeat(2, 1fr); }
.pr-tg { display: flex; align-items: center; gap: 12px; min-height: 50px; border-bottom: 1px solid var(--line); cursor: pointer; }
.pr-tg:last-child { border-bottom: none; }
.pr-tg span { flex: 1; display: flex; flex-direction: column; font-size: 15.5px; font-weight: 600; }
.pr-tg small { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.pr-tg input { width: 22px; height: 22px; accent-color: var(--brand); }
html[data-theme="dark"] :is(.pr-row, .pr-qibla, .pr-search, .pr-city-list) { background: var(--surface); }
html[data-theme="dark"] .pr-row.next { background: #3A2F12; }
html[data-theme="dark"] .pr-row.next .pr-n small { color: #F5D27A; }
html[data-theme="dark"] .pr-bar { background: var(--bg); }
.pr-tg input { appearance: none; -webkit-appearance: none; width: 48px; height: 28px; border-radius: 14px; background: #C9D3D8; position: relative; cursor: pointer; flex: none; margin: 0; transition: background .2s; }
.pr-tg input::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: inset-inline-start .2s; }
.pr-tg input:checked { background: var(--brand); }
.pr-tg input:checked::after { inset-inline-start: 23px; }
.pr-tg input:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ===================================================================== v1.24: view once */
.send-cap-row { display: flex; gap: 8px; align-items: center; }
.send-cap-row .input { flex: 1; min-width: 0; }
.send-cap-row .input:disabled { opacity: .45; }
.vonce-toggle { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 21px; border: 1.5px solid var(--line); background: #fff; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.vonce-toggle svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.vonce-toggle.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.recorder .vonce-toggle { width: 38px; height: 38px; margin-inline-end: 6px; background: transparent; }
.recorder .vonce-toggle.on { background: var(--brand); }
.vonce-box { display: flex; align-items: center; gap: 10px; min-width: 190px; padding: 8px 22px 8px 6px; padding-inline: 6px 22px; border: none; background: transparent; color: inherit; font: inherit; text-align: start; cursor: default; }
.vonce-box.can { cursor: pointer; }
.vonce-ic { flex: 0 0 38px; width: 38px; height: 38px; border-radius: 19px; display: grid; place-items: center; background: rgba(6,98,135,.12); color: var(--brand); }
.vonce-ic svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.vonce-box.can .vonce-ic { background: var(--brand); color: #fff; }
.vonce-box.done .vonce-ic { background: transparent; color: var(--muted); }
.vonce-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vonce-tx b { font-size: 16px; }
.vonce-tx small { font-size: 13px; color: var(--muted); }
.vonce-box.done .vonce-tx b { color: var(--muted); font-weight: 600; }
.vonce-view { position: fixed; inset: 0; z-index: 180; background: #000; color: #fff; display: flex; flex-direction: column; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.vonce-top { display: flex; align-items: center; justify-content: space-between; padding: max(10px, env(safe-area-inset-top)) 12px 10px; }
.vonce-top .icon-btn { color: #fff; background: rgba(255,255,255,.14); }
.vonce-badge { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.vonce-badge svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.vonce-media { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 8px; }
.vonce-media img, .vonce-media video { max-width: 100%; max-height: 100%; object-fit: contain; pointer-events: none; }
.vonce-media video { pointer-events: auto; }
.vonce-media audio { width: min(420px, 92vw); }
.vonce-voice-ic { width: 110px; height: 110px; border-radius: 55px; background: rgba(255,255,255,.1); display: grid; place-items: center; }
.vonce-voice-ic svg { width: 54px; height: 54px; fill: none; stroke: #fff; stroke-width: 1.6; }
.vonce-loading { opacity: .8; }
.vonce-warn { margin: 0; padding: 10px 16px max(14px, env(safe-area-inset-bottom)); text-align: center; font-size: 14px; opacity: .75; }

/* ===================================================================== v1.24: group calls */
.gc-banner { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: #E8F7EE; color: #145C35; border-bottom: 1px solid #C9EBD6; font-weight: 600; }
.gc-banner svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; flex: 0 0 auto; }
.gc-banner .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gc-banner button { border: none; border-radius: 16px; background: #22A45D; color: #fff; font: 700 15px var(--body-font); padding: 6px 16px; cursor: pointer; }
[data-theme="dark"] .gc-banner { background: #123B28; color: #BFF0D3; border-bottom-color: #1D5A3C; }

.gc-screen { position: fixed; inset: 0; z-index: 200; background: radial-gradient(circle at 50% 30%, #0b4d68 0%, #062f40 60%, #041f2b 100%); color: #fff; display: flex; flex-direction: column; padding: max(12px, env(safe-area-inset-top)) 10px max(24px, env(safe-area-inset-bottom)); }
.gc-screen[hidden], .gc-ring[hidden], .gc-bar[hidden] { display: none; }
.gc-head { display: flex; align-items: center; gap: 10px; padding: 4px 4px 10px; }
.gc-head .grow { flex: 1; min-width: 0; }
.gc-title { font-size: 18px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gc-sub { font-size: 14px; opacity: .8; }
.gc-head .icon-btn { color: #fff; background: rgba(255,255,255,.14); }
.gc-grid { flex: 1; min-height: 0; display: grid; gap: 8px; grid-template-columns: 1fr; grid-auto-rows: 1fr; }
.gc-grid.n2 { grid-template-columns: 1fr; }
.gc-grid.n3, .gc-grid.n4 { grid-template-columns: 1fr 1fr; }
.gc-grid.n5, .gc-grid.n6 { grid-template-columns: 1fr 1fr; }
.gc-grid.n7, .gc-grid.n8 { grid-template-columns: 1fr 1fr 1fr; }
@media (min-width: 760px) { .gc-grid.n2 { grid-template-columns: 1fr 1fr; } .gc-grid.n5, .gc-grid.n6 { grid-template-columns: 1fr 1fr 1fr; } .gc-grid.n7, .gc-grid.n8 { grid-template-columns: repeat(4, 1fr); } }
.gc-tile { position: relative; min-height: 0; border-radius: 16px; overflow: hidden; background: rgba(255,255,255,.07); display: grid; place-items: center; }
.gc-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.gc-tile.has-video video { opacity: 1; }
.gc-tile.me video { transform: scaleX(-1); }
.gc-tile .avatar.big { width: 76px; height: 76px; flex-basis: 76px; font-size: 30px; }
.gc-grid.n5 .avatar.big, .gc-grid.n6 .avatar.big, .gc-grid.n7 .avatar.big, .gc-grid.n8 .avatar.big { width: 54px; height: 54px; flex-basis: 54px; font-size: 22px; }
.gc-tile.has-video .avatar { display: none; }
.gc-name { position: absolute; bottom: 6px; inset-inline-start: 8px; max-width: calc(100% - 16px); padding: 2px 8px; border-radius: 10px; background: rgba(0,0,0,.45); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gc-tile.connecting .gc-name::after { content: ' …'; }
.gc-tile.muted .gc-name::before { content: '🔇 '; }
.gc-screen .call-actions { padding-top: 14px; gap: 16px; flex-wrap: wrap; }
.gc-screen .call-btn { width: 56px; height: 56px; }
.gc-ring { position: fixed; inset: 0; z-index: 205; background: radial-gradient(circle at 50% 30%, #0b4d68 0%, #062f40 60%, #041f2b 100%); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: max(48px, env(safe-area-inset-top)) 16px max(40px, env(safe-area-inset-bottom)); text-align: center; }
.gc-ring .avatar.big { width: 110px; height: 110px; flex-basis: 110px; font-size: 44px; margin: 0 auto 14px; }
.gc-ring-title { font-size: 24px; font-weight: 700; }
.gc-ring-sub { font-size: 16px; opacity: .85; margin-top: 6px; }
.gc-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 210; height: calc(36px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); border: none; background: #22A45D; color: #fff; display: flex; align-items: center; justify-content: center; gap: 10px; font: 600 14px var(--body-font); cursor: pointer; }
html.has-gcbar .screen.app { margin-top: calc(36px + env(safe-area-inset-top)); height: calc(100dvh - 36px - env(safe-area-inset-top)); }

/* ===================================================================== v1.25 */
/* text size */
.ts-btn span { font: 700 17px/1 var(--num-font, sans-serif); letter-spacing: -.5px; }
.ts-pop { position: fixed; z-index: 160; display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 16px; background: #fff; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.ts-pop[hidden] { display: none; }
.ts-pop button { width: 52px; height: 44px; border: none; border-radius: 12px; background: var(--brand-soft); color: var(--brand); font: 700 18px/1 var(--num-font, sans-serif); cursor: pointer; }
.ts-pop button:disabled { opacity: .35; cursor: default; }
.ts-val { min-width: 54px; text-align: center; font-weight: 700; color: var(--ink); }
[data-theme="dark"] .ts-pop { background: #12313D; border-color: #1D4656; }
[data-theme="dark"] .ts-val { color: #E6F1F5; }
/* usernames */
.uname-row { display: flex; align-items: center; gap: 0; border-radius: 12px; }
.uname-row .uname-at { padding: 0 8px 0 2px; font: 700 20px var(--num-font, sans-serif); color: var(--muted); }
.uname-row .input { flex: 1; min-width: 0; text-align: left; font-family: var(--num-font, sans-serif); }
.uname-hint { display: block; margin: 2px 0 8px; font-size: 13px; line-height: 1.5; }
.uname-hint.ok { color: #1F8A4C; }
.uname-hint.bad { color: var(--danger); }
.nc-uname { margin-top: 10px; }
.mention { color: var(--brand); font-weight: 700; cursor: pointer; unicode-bidi: isolate; }
.mention.me { background: rgba(6,98,135,.12); border-radius: 6px; padding: 0 3px; }
.msg.out .mention { color: #04506E; }
[data-theme="dark"] .mention, [data-theme="dark"] .msg.out .mention { color: #7FD0F0; }
.mention-pop { margin: 0 12px 6px; max-height: 260px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 -6px 24px rgba(0,0,0,.12); padding: 4px; }
.mention-pop[hidden] { display: none; }
.mention-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: none; border-radius: 10px; background: transparent; cursor: pointer; text-align: start; font: inherit; color: inherit; }
.mention-item .avatar { width: 34px; height: 34px; flex: 0 0 34px; font-size: 15px; }
.mention-item .grow { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.mention-item small { color: var(--muted); direction: ltr; text-align: start; }
.mention-item.on, .mention-item:hover { background: var(--brand-soft); }
[data-theme="dark"] .mention-pop { background: #12313D; border-color: #1D4656; }
/* decline a call with a message */
.qr-dialog { width: min(440px, 94vw); }
.qr-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.qr-item { text-align: start; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); font: inherit; font-size: 16px; color: var(--ink); cursor: pointer; }
.qr-item:hover { border-color: var(--brand); }
.qr-custom { display: flex; gap: 8px; margin-bottom: 10px; }
.qr-custom .input { flex: 1; min-width: 0; }
.qr-custom .btn { min-height: 46px; }
/* v1.25: room for the name in the chat header on phones (the invite link is also in group info) */
@media (max-width: 520px) {
  .head-actions { gap: 0; }
  .head-actions .icon-btn { width: 34px; height: 38px; }
  .head-actions .icon-btn svg { width: 20px; height: 20px; }
  .ts-btn span { font-size: 15px; }
  #room-invite-btn { display: none; }
}

/* v1.25: PDF viewer */
.pdf-view { position: fixed; inset: 0; z-index: 170; background: #3A4A51; display: flex; flex-direction: column; }
.pdf-view[hidden] { display: none; }
.pdf-top { display: flex; align-items: center; gap: 4px; padding: max(8px, env(safe-area-inset-top)) 8px 8px; background: #0D2A36; color: #fff; }
.pdf-top .icon-btn { color: #fff; }
.pdf-top .icon-btn:hover { background: rgba(255,255,255,.12); }
.pdf-title { min-width: 0; display: flex; flex-direction: column; line-height: 1.35; padding: 0 6px; }
.pdf-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.pdf-title small { opacity: .75; font-size: 12.5px; text-align: start; }
.pdf-pages { flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; padding: 12px 8px max(16px, env(safe-area-inset-bottom)); }
.pdf-page { margin: 0 auto 12px; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.3); position: relative; }
.pdf-page canvas { display: block; width: 100%; height: 100%; }
.pdf-msg { color: #fff; text-align: center; padding: 40px 16px; }

/* ---- v1.26: voice message loading spinner, missed call + Call back in the chat list, add person to a call */
.voice-play { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.voice-play .vp-spin { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-dasharray: 40 18; stroke-linecap: round; animation: vpspin .8s linear infinite; }
@keyframes vpspin { to { transform: rotate(360deg); } }
.chat-item { position: relative; }
.chat-bottom .missed-ic { display: inline-flex; flex: 0 0 auto; color: #E5383B; }
.chat-bottom .missed-ic svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.chat-last.missed { color: #E5383B; }
.callback-btn { flex: 0 0 auto; align-self: center; display: inline-flex; align-items: center; gap: 6px; margin-inline-start: 8px; padding: 7px 14px; border-radius: 20px; background: #22A45D; color: #fff; font: 700 14px var(--body-font); white-space: nowrap; cursor: pointer; touch-action: manipulation; }
.callback-btn:hover { background: #1C8F50; }
.callback-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.chat-item .chat-info { min-width: 0; }
@media (max-width: 380px) { .callback-btn span { display: none; } .callback-btn { padding: 8px 10px; } }
.gc-pick-list { max-height: 52vh; margin-top: 10px; }
.gc-pick-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; min-height: 56px; border: none; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.gc-pick-row:hover { background: rgba(6, 98, 135, .07); }
.gc-pick-row .avatar { width: 40px; height: 40px; flex: 0 0 40px; font-size: 17px; }
.gc-pick-add { color: var(--brand); display: inline-flex; }
.gc-pick-add svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; }
.gc-pick .search { width: 100%; margin-top: 6px; }
.gc-pick .row-between { margin-top: 12px; }

/* ===================================================================== v1.27 */
/* hold-to-record (like WhatsApp) */
.composer { position: relative; }
.send-btn { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.hold-panel, .hold-lock { display: none; }
.composer.rec-hold > :not(.hold-panel):not(.hold-lock):not(.send-btn) { visibility: hidden; }
.composer.rec-hold .hold-panel { display: flex; position: absolute; inset-block: 0; inset-inline-start: 12px; inset-inline-end: 76px; align-items: center; gap: 10px; color: var(--danger); font-weight: 600; pointer-events: none; }
.hold-panel bdi { font-family: var(--num-font); font-weight: 700; color: var(--ink); min-width: 40px; }
.hold-hint { margin-inline-start: auto; margin-inline-end: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14.5px; font-weight: 600; white-space: nowrap; transition: opacity .1s; }
.hold-hint svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; animation: holdnudge 1.2s infinite; }
html[dir="rtl"] .hold-hint svg { transform: scaleX(-1); }
@keyframes holdnudge { 50% { translate: -4px 0; } }
html[dir="rtl"] .hold-hint svg { animation-name: holdnudge-r; }
@keyframes holdnudge-r { 50% { translate: 4px 0; } }
.composer.rec-hold .hold-lock { display: flex; flex-direction: column; align-items: center; gap: 2px; position: absolute; bottom: calc(100% + 10px); inset-inline-end: 14px; width: 46px; padding: 10px 0 8px; border-radius: 23px; background: #fff; color: var(--muted); box-shadow: 0 4px 16px rgba(0,0,0,.18); pointer-events: none; z-index: 5; }
.hold-lock svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hold-lock .hl-up { animation: holdup 1.2s infinite; }
@keyframes holdup { 50% { translate: 0 -4px; } }
.composer.rec-hold .send-btn { transform: scale(1.3); background: var(--brand); box-shadow: 0 0 0 8px rgba(6,98,135,.15); position: relative; z-index: 4; transition: transform .12s; }
html[data-theme="dark"] .composer.rec-hold .hold-lock { background: #22303A; color: #cfd8dc; }

/* video call: camera switch button on my own small picture; buttons fit small phones */
.call-local.back-cam { transform: none; }
.call-flip-mini { position: absolute; z-index: 4; top: calc(max(20px, env(safe-area-inset-top)) + 128px); inset-inline-end: 22px; width: 40px; height: 40px; border-radius: 20px; border: none; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; cursor: pointer; }
.call-flip-mini svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.call-screen:not(.is-video) .call-flip-mini, .call-local[hidden] ~ .call-flip-mini { display: none; }
.call-btn.busy, .call-flip-mini.busy { opacity: .5; pointer-events: none; }
@media (max-width: 600px) { .call-flip-mini { top: calc(max(20px, env(safe-area-inset-top)) + 96px); inset-inline-end: 18px; } }
@media (max-width: 520px) {
  .call-actions { gap: 10px; flex-wrap: wrap; padding-inline: 10px; row-gap: 14px; }
  .call-btn { width: 54px; height: 54px; }
  .call-btn svg { width: 23px; height: 23px; }
}
@media (max-width: 360px) { .call-actions { gap: 8px; } .call-btn { width: 48px; height: 48px; } }
/* iPhone app: the screen is being recorded / mirrored -> no picture */
html.captured :is(#call-remote, #call-local, .gc-screen video, #vonce-media) { visibility: hidden !important; }

/* call rating */
.rate-dialog { text-align: center; }
.rate-dialog .h-title { margin-bottom: 4px; }
.rate-stars { display: flex; justify-content: center; gap: 6px; margin: 14px 0 6px; direction: ltr; }
.rate-star { width: 50px; height: 50px; border: none; background: transparent; cursor: pointer; padding: 4px; color: #C9D3D8; transition: transform .12s, color .12s; }
.rate-star svg { width: 100%; height: 100%; fill: currentColor; }
.rate-star.on { color: #F5B301; }
.rate-star:active { transform: scale(.9); }
.rate-issues p { margin: 10px 0 8px; font-weight: 600; }
.rate-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 6px; }
.rate-chip { min-height: 34px; }
.rate-chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.rate-dialog .row-end { margin-top: 14px; }

/* send preview: edit tools and several photos */
.send-edit { display: flex; justify-content: flex-end; gap: 6px; margin-bottom: 8px; }
.se-btn { width: 40px; height: 40px; border-radius: 20px; border: 1px solid var(--line); background: #fff; color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.se-btn:hover { background: var(--brand-soft); color: var(--brand-dark); }
.se-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.send-preview img.send-media { cursor: pointer; }
.send-thumbs { display: flex; gap: 6px; overflow-x: auto; padding: 8px 2px 2px; }
.send-thumb { flex: 0 0 54px; height: 54px; border-radius: 10px; overflow: hidden; border: 2px solid transparent; padding: 0; background: var(--bg); cursor: pointer; font-size: 22px; }
.send-thumb.on { border-color: var(--brand); }
.send-thumb :is(img, video) { width: 100%; height: 100%; object-fit: cover; display: block; }
html[data-theme="dark"] .se-btn { background: var(--surface); color: var(--ink); }

/* photo editor (full screen, above the send dialog) */
dialog.ied { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #0d0d0d; color: #fff; overflow: hidden; }
dialog.ied[open] { display: flex; flex-direction: column; }
dialog.ied::backdrop { background: #000; }
.ied-top, .ied-bottom { display: flex; align-items: center; gap: 6px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); }
.ied-bottom { padding-top: 10px; padding-bottom: max(12px, env(safe-area-inset-bottom)); min-height: 64px; }
.ied-btn { width: 44px; height: 44px; border-radius: 22px; border: none; background: rgba(255,255,255,.1); color: #fff; display: grid; place-items: center; cursor: pointer; }
.ied-btn:disabled { opacity: .35; cursor: default; }
.ied-btn.on { background: #fff; color: #0d0d0d; }
.ied-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ied-stage { flex: 1; min-height: 0; display: grid; place-items: center; position: relative; touch-action: none; }
.ied-wrap { position: relative; overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none; }
.ied-wrap.drawing { cursor: crosshair; }
.ied-wrap canvas { width: 100%; height: 100%; display: block; }
.ied-layer { position: absolute; inset: 0; pointer-events: none; }
.ied-item { position: absolute; transform: translate(-50%, -50%); white-space: pre; text-align: center; line-height: 1.3; font-family: 'Noto Naskh Arabic', 'Scheherazade New', Arial, sans-serif; font-weight: 700; text-shadow: 0 1px 6px rgba(0,0,0,.5); pointer-events: auto; cursor: move; touch-action: none; padding: 2px 6px; border-radius: 6px; }
.ied-item.emoji { font-weight: 400; text-shadow: none; line-height: 1; }
.ied-item.sel { outline: 2px dashed rgba(255,255,255,.9); }
.ied-crop { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,.55); cursor: move; touch-action: none;
  background-image: linear-gradient(rgba(255,255,255,.35) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.35) 1px, transparent 1px);
  background-size: 33.333% 33.333%; background-position: -1px -1px; }
.ied-crop .h { position: absolute; width: 26px; height: 26px; border: 4px solid #fff; }
.ied-crop .nw { top: -6px; left: -6px; border-right: 0; border-bottom: 0; cursor: nwse-resize; }
.ied-crop .ne { top: -6px; right: -6px; border-left: 0; border-bottom: 0; cursor: nesw-resize; }
.ied-crop .sw { bottom: -6px; left: -6px; border-right: 0; border-top: 0; cursor: nesw-resize; }
.ied-crop .se { bottom: -6px; right: -6px; border-left: 0; border-top: 0; cursor: nwse-resize; }
.ied-crop .h::after { content: ''; position: absolute; inset: -14px; } /* bigger finger target */
.ied-colors { display: flex; justify-content: center; gap: 10px; padding: 8px 12px; flex-wrap: wrap; }
.ied-color { width: 30px; height: 30px; border-radius: 15px; border: 2px solid rgba(255,255,255,.6); cursor: pointer; padding: 0; }
.ied-color.on { transform: scale(1.25); border-color: #fff; box-shadow: 0 0 0 2px #0d0d0d, 0 0 0 4px #fff; }
.ied-emojis { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px; max-height: 32vh; overflow-y: auto; padding: 8px 12px; background: #1b1b1b; }
.ied-emoji { font-size: 28px; height: 44px; border: none; background: transparent; cursor: pointer; border-radius: 10px; }
.ied-emoji:hover { background: rgba(255,255,255,.1); }
.ied-croptools, .ied-selbar { display: flex; justify-content: center; gap: 8px; padding: 8px 12px; flex-wrap: wrap; }
.ied-pill { min-height: 38px; padding: 0 16px; border-radius: 19px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.08); color: #fff; font: 600 14.5px var(--body-font); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.ied-pill.primary { background: var(--brand); border-color: var(--brand); }
.ied-pill svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ied-textbox { position: absolute; inset-inline: 0; top: 30%; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; z-index: 3; }
.ied-textbox textarea { width: 100%; background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.4); border-radius: 14px; padding: 12px 14px; font: 700 26px 'Noto Naskh Arabic', 'Scheherazade New', Arial, sans-serif; text-align: center; resize: none; outline: none; }
.ied-textbox .row-end { justify-content: center; gap: 10px; }
.muted-w { color: rgba(255,255,255,.7); }
.ied-done { width: 56px; height: 56px; border-radius: 28px; border: none; background: var(--brand); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.ied-done svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

/* v1.28: who reacted */
.reactors-dialog { width: min(420px, 94vw); padding: 14px 0 6px; }
.rx-head { display: flex; align-items: center; justify-content: space-between; padding: 0 16px 6px; }
.rx-head .h-title { margin: 0; }
.rx-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 6px 16px 10px; border-bottom: 1px solid var(--line); }
.rx-tab { flex: 0 0 auto; min-height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--line); background: transparent; color: var(--ink); font: 600 14px var(--body-font); cursor: pointer; white-space: nowrap; }
.rx-tab.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }
.rx-list { max-height: min(60vh, 460px); overflow-y: auto; padding: 4px 0; }
.rx-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 16px; border: 0; background: transparent; text-align: start; font: inherit; color: inherit; }
button.rx-row { cursor: pointer; }
button.rx-row:hover { background: var(--bg); }
.rx-row .avatar { width: 40px; height: 40px; flex: 0 0 40px; font-size: 16px; }
.rx-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rx-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rx-sub { font-size: 12.5px; color: var(--muted); }
.rx-emoji { font-size: 24px; }
.rx-note { padding: 8px 16px 4px; margin: 0; }
.rx-loading { padding: 12px 16px; }

/* v1.29: audio files */
.audio-msg { display: flex; flex-direction: column; gap: 4px; }
.audio-name { font-size: 13.5px; font-weight: 600; color: var(--ink); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* v1.29: polls */
.poll { min-width: 240px; max-width: 320px; display: flex; flex-direction: column; gap: 4px; }
.poll-q { font-weight: 700; font-size: 15.5px; line-height: 1.4; word-break: break-word; }
.poll-hint { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.poll-opt { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 6px 0; border: 0; background: transparent; text-align: start; color: inherit; font: inherit; cursor: pointer; }
.poll-opt:disabled { cursor: default; }
.poll-mark { flex: 0 0 22px; width: 22px; height: 22px; border-radius: 11px; border: 2px solid var(--muted); display: grid; place-items: center; margin-top: 1px; }
.poll-mark.sq { border-radius: 6px; }
.poll-opt.on .poll-mark { background: var(--brand); border-color: var(--brand); color: #fff; }
.poll-mark svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.poll-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.poll-line { display: flex; justify-content: space-between; gap: 8px; }
.poll-text { word-break: break-word; }
.poll-n { font-family: var(--num-font); font-weight: 600; color: var(--muted); }
.poll-bar { height: 6px; border-radius: 3px; background: rgba(0,0,0,.08); overflow: hidden; }
.poll-bar i { display: block; height: 100%; border-radius: 3px; background: var(--brand); transition: width .3s; }
.poll-view { margin-top: 6px; padding: 8px 0 2px; border: 0; border-top: 1px solid rgba(0,0,0,.08); background: transparent; color: var(--brand); font: 600 14px var(--body-font); cursor: pointer; }
.poll-view:disabled { color: var(--muted); cursor: default; }
html[data-theme="dark"] .poll-bar { background: rgba(255,255,255,.12); }
.poll-dialog { width: min(440px, 94vw); }
.poll-dialog textarea { width: 100%; resize: none; }
.poll-optlabel { margin: 12px 0 6px; }
.poll-opts { display: flex; flex-direction: column; gap: 8px; max-height: 40vh; overflow-y: auto; }
.poll-in { display: flex; align-items: center; gap: 6px; }
.poll-in input { flex: 1; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: var(--bg); color: var(--ink); }
.poll-del svg { width: 18px; height: 18px; }
.poll-multi { display: flex; align-items: center; gap: 8px; margin: 14px 0 4px; font-size: 14.5px; cursor: pointer; }
.poll-multi input { width: 18px; height: 18px; accent-color: var(--brand); }
.pv-q { padding: 0 16px 8px; margin: 0; font-weight: 700; }
.pv-opt { padding: 6px 0 10px; border-bottom: 1px solid var(--line); }
.pv-head { display: flex; justify-content: space-between; gap: 10px; padding: 4px 16px 6px; }

/* v1.30: emoji panel with tabs, stickers */
.emoji-panel { display: flex; flex-direction: column; padding: 0; max-height: 320px; overflow: hidden; width: min(360px, calc(100% - 24px)); }
.emo-tabs { display: flex; gap: 4px; padding: 6px 8px 4px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.emo-tab { flex: 1; min-height: 34px; border: 0; border-radius: 10px; background: transparent; font-size: 20px; cursor: pointer; }
.emo-tab.on { background: var(--brand-soft); }
.emo-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; overflow-y: auto; }
@media (max-width: 820px) { .emo-grid { grid-template-columns: repeat(7, 1fr); } }
.stk-panel { overflow-y: auto; padding: 4px 8px 10px; }
.stk-title { font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 8px 4px 4px; }
.stk-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.stk-btn { aspect-ratio: 1; border: 0; border-radius: 12px; background: transparent; padding: 4px; cursor: pointer; display: grid; place-items: center; }
.stk-btn:hover { background: var(--bg); }
.stk-btn img { width: 100%; height: 100%; object-fit: contain; }
.stk-new { border: 2px dashed var(--line); color: var(--brand); display: flex; flex-direction: column; gap: 2px; font: 600 12px var(--body-font); }
.stk-new svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.stk-wait { padding: 16px; text-align: center; }
html[data-theme="dark"] .emoji-panel { background: var(--surface); }
/* a sticker message: no bubble */
.msg.sticker { background: transparent !important; box-shadow: none; padding: 0; }
.msg.sticker .stk-img { width: 160px; height: 160px; object-fit: contain; display: block; }
.msg.sticker .msg-meta { align-self: flex-end; background: rgba(0,0,0,.35); color: #fff; border-radius: 10px; padding: 1px 8px; margin-top: -22px; position: relative; }
.msg.sticker .msg-meta * { color: #fff !important; }
.msg.sticker .quote, .msg.sticker .sender, .msg.sticker .fwd-label { background: var(--in); border-radius: 10px; padding: 4px 8px; }
/* photo editor in sticker mode: shape preview + shape buttons */
.ied-shapes { display: flex; justify-content: center; gap: 8px; padding: 6px 12px; }
.ied-wrap.stk-round { border-radius: 18%; outline: 6px solid #fff; }
.ied-wrap.stk-circle { border-radius: 50%; outline: 6px solid #fff; }
.ied-wrap.stk-square { border-radius: 4%; outline: 6px solid #fff; }

/* v1.30.2: caption box with several lines */
.send-caption { resize: none; min-height: 44px; max-height: 30vh; line-height: 1.6; padding-top: 10px; padding-bottom: 10px; overflow-y: auto; font: inherit; }
/* a photo with a long caption: the text stays as wide as the photo, like WhatsApp */
.msg:has(> img.photo) { max-width: min(75%, 420px); }

/* ===================================================================== v1.31: chat looks like WhatsApp */
/* messages in a row from the same person stick together; the first has the name and a bubble tail */
.messages { gap: 2px; }
.messages > .msg.first, .messages > .msg.sys, .messages > .day + .msg { margin-top: 8px; }
.msg.in.cont { border-start-start-radius: 16px; }
.msg.out.cont { border-start-end-radius: 16px; }
.msg.in.first { border-start-start-radius: 0; }
.msg.out.first { border-start-end-radius: 0; }
.msg.first:not(.sticker)::before { content: ''; position: absolute; top: 0; width: 9px; height: 13px; background: inherit; }
.msg.in.first:not(.sticker)::before { inset-inline-start: -8px; }
.msg.out.first:not(.sticker)::before { inset-inline-end: -8px; }
html[dir="ltr"] .msg.in.first::before, html:not([dir]) .msg.in.first::before { clip-path: polygon(0 0, 100% 0, 100% 100%); }
html[dir="ltr"] .msg.out.first::before, html:not([dir]) .msg.out.first::before { clip-path: polygon(0 0, 100% 0, 0 100%); }
html[dir="rtl"] .msg.in.first::before { clip-path: polygon(0 0, 100% 0, 0 100%); }
html[dir="rtl"] .msg.out.first::before { clip-path: polygon(0 0, 100% 0, 100% 100%); }
.msg.flash::before { background: inherit; }
/* groups: the sender's small photo next to the last message of a run */
.msg.with-av { margin-inline-start: 38px; }
.msg-av { position: absolute; inset-inline-start: -38px; bottom: 0; width: 30px !important; height: 30px !important; flex: 0 0 30px !important; font-size: 13px !important; cursor: pointer; }
.msg.has-reacts .msg-av { bottom: -14px; }
/* the quoted message: coloured bar and name, up to 3 lines */
.quote { border-inline-start: 4px solid var(--qc, var(--brand)) !important; padding: 6px 10px !important; border-radius: 8px; }
.quote b { color: var(--qc, var(--brand)); font-weight: 700; }
.quote span { white-space: normal !important; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; line-height: 1.5; }
/* reactions sit on the bubble's lower edge */
.msg.has-reacts { margin-bottom: 18px; }
.msg.has-reacts > .reacts { position: absolute; bottom: -18px; inset-inline-start: 10px; margin: 0; z-index: 1; }
.msg.has-reacts > .reacts .react-chip { box-shadow: 0 1px 3px rgba(0,0,0,.18); border-color: transparent; min-height: 24px; }
html[data-theme="dark"] .msg.has-reacts > .reacts .react-chip { background: var(--surface2); }
/* message text: a bit larger and darker */
.msg-text { color: #0E1B21; }
html[data-theme="dark"] .msg-text { color: var(--ink); }
@media (max-width: 820px) { .msg-text { font-size: calc(16.5px * var(--msg-scale, 1)); line-height: 1.6; } }
/* header: on phones search, text size, invite and info go into the ⋮ menu */
.conv-head { position: relative; }
.head-more { display: none; }
.head-menu { position: absolute; top: calc(100% - 6px); inset-inline-end: 10px; z-index: 30; min-width: 190px; background: #fff; border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.18); padding: 6px 0; display: flex; flex-direction: column; }
.head-mi { border: 0; background: transparent; text-align: start; padding: 11px 18px; font: 500 15px var(--body-font); color: var(--ink); cursor: pointer; }
.head-mi:hover { background: var(--bg); }
html[data-theme="dark"] .head-menu { background: var(--surface); }
@media (max-width: 820px) {
  .head-more { display: grid; }
  #text-size-btn, #conv-search-btn, #room-invite-btn, #room-info-btn { display: none !important; }
  .conv-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
}
/* composer: camera next to the mic (phones), hidden while typing */
.cam-btn { flex: 0 0 auto; }
.composer:has(.send-btn.has-text) .cam-btn { display: none; }
@media (hover: hover) and (pointer: fine) { .cam-btn { display: none; } }
/* recording wave on a canvas */
.rec-wave { color: var(--danger); }
.rec-canvas { width: 100%; height: 100%; display: block; opacity: .8; }
.hold-lock.armed { color: var(--brand); transform: translateY(-12px) !important; }

/* v1.31.1 – WhatsApp-like weight: message text slightly bolder, quote lighter */
.msg-text { font-weight: 600; }
.msg .quote span, .reply-quote span { font-weight: 400; color: #667781; font-size: 13.5px; }
.msg .quote b, .reply-quote b { font-weight: 700; }

/* v1.31.2 – like WhatsApp: each message / paragraph takes its own direction (English LTR, Pashto RTL) */
.msg-text, .quote span, .reply-quote span, #reply-text, .chat-last, .send-caption, #msg-input, .poll-q, .file-name {
  unicode-bidi: plaintext;
  text-align: start;
}

/* ===================== v1.32 ===================== */
/* Close / Cancel / Save always visible: the button row at the bottom of a dialog stays on screen while the rest scrolls */
:where(.dialog) { max-height: min(92dvh, 960px); overscroll-behavior: contain; }
.dialog > form > .row-end:last-child, .dialog > form > .row-between:last-child,
.dlg-body > .row-end:last-child, .dlg-body > .row-between:last-child {
  position: sticky; bottom: 0; z-index: 3; background: #fff; margin-top: 6px; padding: 12px 0 2px;
  border-top: 1px solid var(--line); box-shadow: 0 -10px 14px -12px rgba(11,42,54,.25);
}
html[data-theme="dark"] :is(.dialog > form > .row-end:last-child, .dialog > form > .row-between:last-child, .dlg-body > .row-end:last-child, .dlg-body > .row-between:last-child) { background: var(--surface); }
.set-top #settings-x, .sheet-x { width: 40px; height: 40px; border-radius: 20px; background: var(--brand-soft); color: var(--brand); flex: 0 0 40px; }
.set-top #settings-x svg, .sheet-x svg { width: 22px; height: 22px; stroke-width: 2.4; }
.set-top { position: sticky; top: 0; z-index: 3; background: #fff; border-bottom: 1px solid var(--line); }
.set-foot { flex: 0 0 auto; }
.settings-dialog form { height: 100%; }
@media (max-width: 820px) {
  .set-top { padding-top: max(12px, env(safe-area-inset-top)); }
  .set-foot { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .set-foot .btn { flex: 1; min-height: 46px; }
}
html[data-theme="dark"] .set-top { background: var(--surface); }

/* sheet dialogs (Select contact, Contact info): header and scrolling body; full screen on phones */
.sheet-dialog { padding: 0; width: min(480px, 96vw); height: min(760px, 92dvh); max-height: 92dvh; overflow: hidden; }
.sheet-dialog[open] { display: flex; flex-direction: column; }
.sheet-dialog > form { display: flex; flex-direction: column; gap: 0; height: 100%; min-height: 0; }
.sheet-top { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fff; flex: 0 0 auto; }
.sheet-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.sheet-title .h-title { font-size: 22px; }
.sheet-title small { font-size: 13px; }
.sheet-search { padding: 8px 14px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.sheet-search .search { width: 100%; margin: 0; }
.sheet-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 8px max(16px, env(safe-area-inset-bottom)); overscroll-behavior: contain; }
@media (max-width: 820px) {
  .sheet-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  .sheet-top { padding-top: max(12px, env(safe-area-inset-top)); }
}
html[data-theme="dark"] :is(.sheet-top, .sheet-dialog) { background: var(--surface); }

.sel-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 8px; border: 0; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; border-radius: 12px; }
.sel-row:hover, .sel-row:focus-visible { background: var(--brand-soft); }
.sel-row b { font-weight: 600; font-size: 16px; }
.sel-ic { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 23px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 20px; }
.sel-ic svg { width: 22px; height: 22px; }
.sel-row-wrap { display: flex; align-items: center; }
.sel-row-wrap .sel-row { flex: 1; }
.sel-qr { flex: 0 0 auto; color: var(--brand); }
.sel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 8px 6px; color: var(--muted); font-size: 14px; font-weight: 600; }
.sel-list .contact-row { padding: 8px; }
.sel-list .contact-row .avatar { width: 46px; height: 46px; flex-basis: 46px; font-size: 18px; }
.sel-note { padding: 6px 10px; }
.nc-manual { margin: 4px 8px 8px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; gap: 8px; }
.nc-manual .nc-find-row { position: static; border: 0; box-shadow: none; padding: 0; background: none; }

/* contact info */
.ci-head { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 8px 12px; text-align: center; }
.ci-head .avatar.clickable { cursor: zoom-in; }
.ci-name { font-family: var(--head-font); font-size: 24px; font-weight: 700; display: flex; align-items: center; gap: 4px; }
.ci-actions { display: flex; gap: 10px; margin-top: 10px; }
.ci-act { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 88px; padding: 10px 8px; border: 1px solid var(--line); border-radius: 14px; background: none; color: var(--brand); cursor: pointer; font: inherit; font-size: 13px; }
.ci-act:hover { background: var(--brand-soft); }

/* media / links / docs + timer row */
.x-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 10px; margin: 6px 0; border: 1px solid var(--line); border-radius: 14px; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.x-row:disabled { cursor: default; opacity: .85; }
.x-row:not(:disabled):hover { background: var(--brand-soft); }
.x-row .grow { display: flex; flex-direction: column; line-height: 1.4; }
.x-row small { color: var(--muted); font-size: 13px; }
.x-ic { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; overflow: hidden; }
.x-ic img { width: 100%; height: 100%; object-fit: cover; }
.x-chev { color: var(--muted); }
html[dir="rtl"] .x-chev svg, html[dir="rtl"] .x-goto svg { transform: scaleX(-1); }
.x-media { margin: 8px 0; border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.x-head { padding: 0 4px 8px; }
.x-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.x-tab { flex: 1; padding: 8px 4px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; border-bottom: 3px solid transparent; }
.x-tab.on { color: var(--brand); border-bottom-color: var(--brand); }
.x-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
@media (max-width: 480px) { .x-grid { grid-template-columns: repeat(3, 1fr); } }
.x-tile { position: relative; aspect-ratio: 1; border: 0; padding: 0; background: #0D2A36; border-radius: 6px; overflow: hidden; cursor: pointer; }
.x-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.x-play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }
.x-play svg { width: 30px; height: 30px; filter: drop-shadow(0 1px 3px rgba(0,0,0,.6)); }
.x-dur { position: absolute; bottom: 3px; inset-inline-end: 5px; color: #fff; font-size: 11px; text-shadow: 0 1px 2px #000; }
.x-link { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-radius: 10px; color: inherit; text-decoration: none; }
.x-link:hover { background: var(--brand-soft); }
.x-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.4; }
.x-txt b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: plaintext; text-align: start; }
.x-txt small { color: var(--muted); font-size: 12px; }
.x-goto { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 17px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.x-goto:hover { background: var(--line); color: var(--brand); }
.x-more { width: 100%; margin-top: 8px; }
.x-note { padding: 8px 4px; }

/* disappearing timer */
.dm-icon { width: 64px; height: 64px; border-radius: 32px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin: 0 auto; }
.dm-icon svg { width: 34px; height: 34px; }
#dm-dialog .h-title { text-align: center; }
.dm-opts { display: flex; flex-direction: column; gap: 4px; }
.dm-opt { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 10px; cursor: pointer; }
.dm-opt:hover { background: var(--brand-soft); }
.dm-opt input { width: 20px; height: 20px; accent-color: var(--brand); }
#conv-name.dm-on::after { content: ''; display: inline-block; width: 15px; height: 15px; margin-inline-start: 6px; vertical-align: -2px; opacity: .75;
  background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='13' r='8'/%3E%3Cpath d='M12 9v4l2.5 2.5M9 2h6'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='13' r='8'/%3E%3Cpath d='M12 9v4l2.5 2.5M9 2h6'/%3E%3C/svg%3E") center/contain no-repeat; }

/* ---------- Status ---------- */
.st-strip { display: flex; gap: 12px; padding: 4px 14px 10px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.st-strip::-webkit-scrollbar { display: none; }
.st-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 64px; flex: 0 0 64px; }
.st-ring { width: 60px; height: 60px; border-radius: 30px; padding: 3px; border: 0; cursor: pointer; display: grid; place-items: center; background: transparent; }
.st-ring .avatar { width: 52px; height: 52px; flex-basis: 52px; border-radius: 26px; font-size: 20px; border: 2px solid #fff; }
.st-ring.new { background: conic-gradient(var(--brand), #1DAA61, var(--brand)); }
.st-ring.has { background: var(--brand); }
.st-ring.seen { background: #B8C6CC; }
.st-ring.none { background: transparent; }
.st-add { position: absolute; top: 40px; inset-inline-end: 2px; width: 22px; height: 22px; border-radius: 11px; border: 2px solid #fff; background: #1DAA61; color: #fff; display: grid; place-items: center; padding: 0; cursor: pointer; }
.st-add svg { width: 13px; height: 13px; stroke-width: 3; }
.st-name { font-size: 12px; color: var(--muted); max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.5; }
html[data-theme="dark"] :is(.st-ring .avatar, .st-add) { border-color: var(--surface); }

.st-new { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000; color: #fff; }
.st-new[open] { display: flex; flex-direction: column; }
.st-new::backdrop { background: #000; }
.st-new-top { position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: max(12px, env(safe-area-inset-top)) 12px 12px; }
.st-icon { width: 44px; height: 44px; border-radius: 22px; border: 0; background: rgba(0,0,0,.35); color: #fff; display: grid; place-items: center; cursor: pointer; flex: 0 0 44px; }
.st-new-body { flex: 1; display: grid; place-items: center; min-height: 0; transition: background .2s; }
.st-new-text { width: min(90vw, 640px); min-height: 40vh; background: transparent; border: 0; outline: none; resize: none; color: #fff; text-align: center; font-family: var(--head-font); font-size: 30px; line-height: 1.5; padding-top: 18vh; }
.st-new-text::placeholder { color: rgba(255,255,255,.7); }
.st-new-media { max-width: 100%; max-height: calc(100dvh - 150px); object-fit: contain; }
.st-new-foot { display: flex; align-items: center; gap: 10px; padding: 10px 12px max(14px, env(safe-area-inset-bottom)); background: rgba(0,0,0,.4); }
.st-caption { flex: 1; min-width: 0; padding: 12px 16px; border-radius: 24px; border: 0; background: rgba(255,255,255,.14); color: #fff; outline: none; }
.st-caption::placeholder { color: rgba(255,255,255,.7); }
.st-send { width: 50px; height: 50px; flex: 0 0 50px; border-radius: 25px; border: 0; background: #1DAA61; color: #fff; display: grid; place-items: center; cursor: pointer; margin-inline-start: auto; }
html[dir="rtl"] .st-send svg { transform: scaleX(-1); }
.st-busy { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(0,0,0,.45); }

.st-view { position: fixed; inset: 0; z-index: 260; background: #000; color: #fff; display: flex; flex-direction: column; user-select: none; -webkit-user-select: none; }
html.st-open, html.st-open body { overflow: hidden; }
.st-bars { display: flex; gap: 4px; padding: max(8px, env(safe-area-inset-top)) 10px 0; position: relative; z-index: 2; }
.st-bar { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.35); overflow: hidden; }
.st-bar i { display: block; height: 100%; width: 0; background: #fff; }
.st-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px; position: relative; z-index: 2; }
html[dir="rtl"] #st-view-x svg { transform: scaleX(-1); }
.st-av .avatar { width: 40px; height: 40px; flex-basis: 40px; border-radius: 20px; font-size: 16px; }
.st-who { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.st-who small { opacity: .8; font-size: 12px; }
.st-stage { flex: 1; min-height: 0; display: grid; place-items: center; position: relative; touch-action: none; }
.st-text { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; }
.st-text-in { font-family: var(--head-font); font-size: clamp(24px, 5vw, 40px); line-height: 1.5; text-align: center; white-space: pre-wrap; word-break: break-word; max-width: 720px; }
.st-media { max-width: 100%; max-height: 100%; object-fit: contain; pointer-events: none; }
.st-caption-out { padding: 10px 16px; text-align: center; background: rgba(0,0,0,.45); white-space: pre-wrap; unicode-bidi: plaintext; }
.st-foot { display: flex; align-items: center; gap: 10px; padding: 10px 12px max(14px, env(safe-area-inset-bottom)); }
.st-eye { align-self: center; margin: 8px auto max(16px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: 20px; border: 0; background: rgba(255,255,255,.16); color: #fff; font: inherit; cursor: pointer; }
.st-viewers { position: absolute; left: 0; right: 0; bottom: 0; max-height: 60%; overflow-y: auto; z-index: 4; background: #fff; color: var(--ink); border-radius: 18px 18px 0 0; padding: 12px 16px max(16px, env(safe-area-inset-bottom)); }
.st-viewers-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
html[data-theme="dark"] .st-viewers { background: var(--surface); }

.sheet-scroll.searching > .sel-row, .sheet-scroll.searching > .sel-row-wrap, .sheet-scroll.searching > .nc-manual { display: none; }
.ci-name { line-height: 1.3; }
.ci-name .verified { display: inline-flex; }
.ci-name .verified svg { width: 20px; height: 20px; }
.st-view .st-head, .st-view .st-bars { background: linear-gradient(rgba(0,0,0,.35), rgba(0,0,0,0)); }
