/* Talkino — رابط کاربری پیام‌رسان */
:root {
  --bg: #eef1f5;
  --panel: #ffffff;
  --panel-2: #f6f7f9;
  --line: #e4e7ec;
  --text: #17202c;
  --muted: #6b7686;
  --hover: #f1f4f8;
  --in: #ffffff;
  --out: var(--accent-l);
  --out-text: #10233d;
  --meta: #7d8896;
  --chat-bg: #dfe7ef;
  --pattern: rgba(70, 110, 160, .07);
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 18px rgba(16, 24, 40, .07);
  --danger: #e5484d;
  --ok: #2fae66;
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #0e1621;
  --panel: #17212b;
  --panel-2: #1d2733;
  --line: #243142;
  --text: #e9eef4;
  --muted: #8a99ab;
  --hover: #202b38;
  --in: #182533;
  --out: var(--accent-dk);
  --out-text: #eaf2ff;
  --meta: #8fa0b3;
  --chat-bg: #0e1621;
  --pattern: rgba(120, 160, 210, .05);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 22px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --bg: #0e1621; --panel: #17212b; --panel-2: #1d2733; --line: #243142; --text: #e9eef4; --muted: #8a99ab;
    --hover: #202b38; --in: #182533; --out: var(--accent-dk); --out-text: #eaf2ff; --meta: #8fa0b3; --chat-bg: #0e1621;
    --pattern: rgba(120, 160, 210, .05); --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 22px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Vazirmatn, Tahoma, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent); }
img { max-width: 100%; }
[hidden] { display: none !important; }
.ltr { direction: ltr; text-align: left; unicode-bidi: plaintext; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- بوت ---------- */
#app { height: 100%; height: 100dvh; }
.boot-splash { height: 100%; display: grid; place-content: center; gap: 22px; justify-items: center; }
.boot-logo { width: 74px; height: 74px; border-radius: 22px; background: var(--accent) center/60% no-repeat; box-shadow: var(--shadow);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M5 4h14a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3h-3l1 3-5-3H5a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3z'/%3E%3C/svg%3E"); }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- دکمه‌ها و فرم ---------- */
.btn { white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 22px; border-radius: 14px; background: var(--accent); color: #fff; font-weight: 700; transition: background .15s, transform .1s, opacity .15s; }
.btn:hover { background: var(--accent-d); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--hover); }
.btn.soft { background: var(--hover); color: var(--text); }
.btn.danger { background: var(--danger); }
.btn .spinner { width: 18px; height: 18px; border-width: 2px; border-color: rgba(255,255,255,.4); border-top-color: #fff; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--muted); transition: background .15s, color .15s; flex: none; position: relative; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin: 0 4px 6px; }
.input { width: 100%; height: 50px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--panel); padding: 0 16px; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 90px; padding: 12px 16px; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.input-wrap { position: relative; }
.input-wrap .prefix { position: absolute; inset-inline-end: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); direction: ltr; pointer-events: none; }
.hint { font-size: 12.5px; color: var(--muted); margin: 6px 4px 0; }
.hint.err { color: var(--danger); }
.hint.ok { color: var(--ok); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; margin: 4px 2px 16px; font-size: 14px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: 26px; background: var(--line); transition: .2s; }
.switch i::after { content: ""; position: absolute; width: 20px; height: 20px; top: 3px; inset-inline-start: 3px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(-18px); }

/* ---------- ورود ---------- */
.auth { height: 100%; overflow-y: auto; display: grid; place-items: center; padding: 24px 16px calc(24px + var(--safe-b));
  background: radial-gradient(1200px 600px at 100% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%), radial-gradient(900px 500px at -10% 110%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 410px; background: var(--panel); border-radius: 26px; padding: 34px 28px 26px; box-shadow: var(--shadow); text-align: center; animation: rise .35s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.auth-card .logo { width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 26px; background: var(--accent) center/62% no-repeat; box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 40%, transparent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M5 4h14a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3h-3l1 3-5-3H5a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3z'/%3E%3C/svg%3E"); }
.auth-card .logo.img { background: none; box-shadow: none; }
.auth-card .logo.img img { width: 100%; height: 100%; object-fit: contain; }
.auth-card h1 { font-size: 21px; margin: 0 0 6px; }
.auth-card p.sub { color: var(--muted); margin: 0 0 24px; font-size: 14px; }
.auth-card form { text-align: right; }
.auth-card .input.mobile { font-size: 19px; letter-spacing: 1.5px; text-align: center; direction: ltr; height: 56px; }
.auth-card .input.code { font-size: 26px; letter-spacing: 12px; text-align: center; direction: ltr; height: 62px; font-weight: 700; }
.auth-card .link { color: var(--accent); font-size: 13.5px; display: inline-block; margin-top: 14px; }
.auth-card .test-code { background: #fff6dd; color: #6b4e00; border-radius: 12px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 14px; }
html[data-theme="dark"] .auth-card .test-code { background: #3a3014; color: #ffe39a; }
.auth-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }
.auth-foot a { color: inherit; text-decoration: none; }
.terms { font-size: 12px; color: var(--muted); margin-top: 14px; text-align: center; white-space: pre-line; }

/* ---------- آواتار ---------- */
.av { width: 48px; height: 48px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px; overflow: hidden; position: relative; background: var(--c, var(--accent)); user-select: none; }
.av img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.av.sm { width: 40px; height: 40px; font-size: 16px; }
.av.xs { width: 32px; height: 32px; font-size: 13px; }
.av.lg { width: 112px; height: 112px; font-size: 40px; }
.av.saved { background: linear-gradient(135deg, #5aa9ff, #2b6fe0); }
.av-wrap { position: relative; flex: none; }
.av-wrap .dot { position: absolute; bottom: 1px; inset-inline-start: 1px; width: 13px; height: 13px; border-radius: 50%; background: #3bc46d; border: 2.5px solid var(--panel); }
.tick { display: inline-block; width: 17px; height: 17px; vertical-align: -3px; margin-inline-start: 3px; flex: none; }

/* ---------- چیدمان اصلی ---------- */
.shell { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; height: 100%; }
.side { background: var(--panel); border-inline-start: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; position: relative; z-index: 2; }
.main { display: flex; flex-direction: column; min-width: 0; background: var(--chat-bg); position: relative; }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .main { position: fixed; inset: 0; transform: translateX(-100%); transition: transform .25s cubic-bezier(.3, .7, .2, 1); z-index: 5; }
  .shell.in-chat .main { transform: none; }
  .shell.in-chat .side { visibility: hidden; transition: visibility 0s .25s; }
}

.side-head { display: flex; align-items: center; gap: 6px; padding: calc(10px + var(--safe-t)) 10px 8px; }
.side-head .title { font-weight: 800; font-size: 18px; flex: 1; padding-inline-start: 4px; display: flex; align-items: center; gap: 8px; }
.side-head .title .conn { font-size: 12px; font-weight: 400; color: var(--muted); }
.search { margin: 2px 12px 8px; position: relative; }
.search input { width: 100%; height: 42px; border-radius: 21px; border: 0; background: var(--panel-2); padding: 0 42px 0 16px; outline: none; transition: box-shadow .15s; }
.search input:focus { box-shadow: 0 0 0 2px var(--accent) inset; background: var(--panel); }
.search svg { position: absolute; right: 13px; top: 10px; width: 21px; height: 21px; color: var(--muted); }
.list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 6px 90px; }
.list-title { font-size: 13px; color: var(--muted); padding: 10px 14px 4px; font-weight: 600; }
.item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 14px; cursor: pointer; transition: background .12s; position: relative; }
.item:hover { background: var(--hover); }
.item.active { background: var(--accent); color: #fff; }
.item.active .sub, .item.active .time, .item.active .tick-s { color: rgba(255,255,255,.85) !important; }
.item .body { flex: 1; min-width: 0; }
.item .row { display: flex; align-items: center; gap: 8px; }
.item .name { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; }
.item .name > span { overflow: hidden; text-overflow: ellipsis; }
.item .time { font-size: 12px; color: var(--muted); flex: none; }
.item .sub { color: var(--muted); font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .sub b { color: var(--accent); font-weight: 600; }
.item.active .sub b { color: #fff; }
.badge { min-width: 22px; height: 22px; border-radius: 11px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; padding: 0 6px; flex: none; }
.item.active .badge { background: #fff; color: var(--accent); }
.tick-s { color: var(--accent); display: inline-flex; flex: none; }
.tick-s svg { width: 18px; height: 18px; }
.empty { text-align: center; color: var(--muted); padding: 50px 24px; font-size: 14px; }
.empty svg { width: 54px; height: 54px; opacity: .45; margin-bottom: 10px; stroke-width: 1.4; }
.fab { position: absolute; bottom: calc(22px + var(--safe-b)); inset-inline-end: 22px; width: 56px; height: 56px; border-radius: 18px; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 45%, transparent); transition: transform .15s, background .15s; z-index: 3; }
.fab:hover { background: var(--accent-d); transform: translateY(-2px); }
.side-brand { font-size: 11.5px; color: var(--muted); text-align: center; padding: 6px 0 calc(8px + var(--safe-b)); border-top: 1px solid var(--line); }
.side-brand a { color: inherit; text-decoration: none; }

/* ---------- کشوی منو ---------- */
.drawer-back { position: fixed; inset: 0; background: rgba(8, 14, 24, .45); z-index: 30; opacity: 0; transition: opacity .2s; }
.drawer-back.show { opacity: 1; }
.drawer { position: fixed; top: 0; bottom: 0; right: 0; width: min(320px, 86vw); background: var(--panel); z-index: 31; transform: translateX(100%); transition: transform .25s cubic-bezier(.3,.7,.2,1); display: flex; flex-direction: column; box-shadow: var(--shadow); }
.drawer.show { transform: none; }
.drawer .me { padding: calc(22px + var(--safe-t)) 20px 18px; background: linear-gradient(135deg, var(--accent), var(--accent-d)); color: #fff; }
.drawer .me .av { border: 3px solid rgba(255,255,255,.35); width: 64px; height: 64px; font-size: 24px; margin-bottom: 10px; }
.drawer .me .n { font-weight: 800; font-size: 17px; }
.drawer .me .u { opacity: .85; font-size: 13.5px; direction: ltr; text-align: right; }
.menu { padding: 8px; overflow-y: auto; flex: 1; }
.menu button, .menu a { display: flex; align-items: center; gap: 16px; width: 100%; padding: 12px 14px; border-radius: 12px; text-align: right; color: var(--text); text-decoration: none; font-size: 15px; }
.menu button:hover, .menu a:hover { background: var(--hover); }
.menu svg { color: var(--muted); }
.menu .sp { flex: 1; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.drawer .foot { padding: 12px 18px calc(14px + var(--safe-b)); font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); text-align: center; line-height: 1.9; }
.drawer .foot a { color: var(--accent); text-decoration: none; }

/* ---------- سرصفحه گفتگو ---------- */
.chat-head { display: flex; align-items: center; gap: 10px; padding: calc(8px + var(--safe-t)) 8px 8px; background: var(--panel); border-bottom: 1px solid var(--line); min-height: 62px; z-index: 3; }
.chat-head .who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; cursor: pointer; border-radius: 12px; padding: 2px 4px; }
.chat-head .who .t { min-width: 0; }
.chat-head .n { font-weight: 800; font-size: 15.5px; display: flex; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .s { font-size: 12.5px; color: var(--muted); }
.chat-head .s.on { color: var(--accent); }
.back-btn { display: none; }
@media (max-width: 820px) { .back-btn { display: inline-grid; } }

.welcome { flex: 1; display: grid; place-content: center; text-align: center; color: var(--muted); padding: 20px; }
.welcome .bubble-hint { background: color-mix(in srgb, var(--panel) 75%, transparent); backdrop-filter: blur(6px); padding: 8px 18px; border-radius: 20px; font-size: 14px; }

/* ---------- پیام‌ها ---------- */
.msgs-wrap { flex: 1; position: relative; min-height: 0; }
.msgs { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px clamp(10px, 4vw, 60px) 8px;
  background-color: var(--chat-bg);
  background-image: radial-gradient(var(--pattern) 1.5px, transparent 1.6px), radial-gradient(var(--pattern) 1.5px, transparent 1.6px);
  background-size: 28px 28px; background-position: 0 0, 14px 14px; }
.msgs-inner { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 3px; }
.day { align-self: center; position: sticky; top: 4px; z-index: 1; background: color-mix(in srgb, var(--panel) 82%, transparent); backdrop-filter: blur(6px); color: var(--muted); font-size: 12.5px; padding: 3px 13px; border-radius: 14px; margin: 10px 0 6px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.unread-sep { align-self: stretch; text-align: center; font-size: 12.5px; color: var(--accent); background: color-mix(in srgb, var(--panel) 80%, transparent); padding: 3px; margin: 6px 0; border-radius: 10px; }
.m { display: flex; max-width: min(78%, 560px); align-self: flex-start; position: relative; animation: pop .16s ease-out; }
.m.out { align-self: flex-end; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.b { background: var(--in); border-radius: 18px; padding: 6px 12px 6px; box-shadow: 0 1px 1.5px rgba(16, 24, 40, .1); position: relative; min-width: 76px; word-wrap: break-word; overflow-wrap: anywhere; }
.m.out .b { background: var(--out); color: var(--out-text); }
.m.in.tail .b { border-end-start-radius: 6px; }
.m.out.tail .b { border-end-end-radius: 6px; }
.b .txt { white-space: pre-wrap; unicode-bidi: plaintext; text-align: start; }
.b .txt a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.m.big-emoji .b { background: none; box-shadow: none; padding: 0; }
.m.big-emoji .txt { font-size: 44px; line-height: 1.2; }
.m.big-emoji .meta { background: color-mix(in srgb, var(--panel) 80%, transparent); border-radius: 10px; padding: 0 6px; }
.meta { float: left; display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--meta); margin: 8px 10px -4px -4px; line-height: 1; user-select: none; position: relative; top: 2px; }
.m.out .meta { color: color-mix(in srgb, var(--out-text) 60%, transparent); }
.meta svg { width: 17px; height: 17px; stroke-width: 2.1; }
.meta .seen { color: var(--accent); }
html[data-theme="dark"] .meta .seen { color: #7cc0ff; }
.meta .err { color: var(--danger); }
.reply-q { display: block; border-inline-start: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); border-radius: 8px; padding: 4px 9px; margin: 2px -4px 6px; font-size: 13.5px; cursor: pointer; max-width: 100%; }
.reply-q b { display: block; color: var(--accent); font-size: 13px; }
.reply-q span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; opacity: .85; }
.m.hl .b { animation: hl 1.4s ease; }
@keyframes hl { 0%, 60% { box-shadow: 0 0 0 3px var(--accent); } }

/* عکس */
.m.has-img .b { padding: 4px; }
.m.has-img .txt { padding: 4px 8px 2px; }
.m.has-img .meta.on-img { position: absolute; bottom: 10px; left: 10px; margin: 0; background: rgba(0,0,0,.45); color: #fff; padding: 3px 7px; border-radius: 10px; float: none; top: auto; }
.m.has-img .meta.on-img .seen { color: #fff; }
.img-box { position: relative; border-radius: 14px; overflow: hidden; background: color-mix(in srgb, var(--text) 8%, transparent); cursor: zoom-in; max-width: 100%; }
.img-box img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s; }
.img-box img.ok { opacity: 1; }
.prog { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.28); }
.ring { width: 52px; height: 52px; position: relative; display: grid; place-items: center; color: #fff; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); width: 52px; height: 52px; }
.ring circle { fill: none; stroke-width: 3.5; }
.ring .bg { stroke: rgba(255,255,255,.3); }
.ring .fg { stroke: #fff; stroke-linecap: round; transition: stroke-dashoffset .2s; }
.ring button { width: 40px; height: 40px; border-radius: 50%; background: rgba(0,0,0,.35); color: #fff; display: grid; place-items: center; position: relative; z-index: 1; }
.ring button svg { position: static; transform: none; width: 18px; height: 18px; }
.ring .pct { position: absolute; bottom: -20px; font-size: 11.5px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); white-space: nowrap; }

/* فایل */
.file { display: flex; align-items: center; gap: 12px; padding: 4px 0 2px; min-width: 210px; max-width: 330px; }
.file .ic { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; position: relative; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; }
.m.out .file .ic { background: color-mix(in srgb, var(--accent) 85%, #000); }
.file .ic .ring { position: absolute; inset: -2px; width: 52px; height: 52px; }
.file .ic .ring svg { width: 52px; height: 52px; }
.file .ic .ring .bg { stroke: rgba(255,255,255,.25); }
.file .fi { min-width: 0; flex: 1; }
.file .fn { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: right; unicode-bidi: plaintext; }
.file .fs { font-size: 12.5px; opacity: .7; }
.file a.ic { text-decoration: none; }
.expired { font-size: 13px; opacity: .7; padding: 4px 2px; display: flex; gap: 6px; align-items: center; }
.m.deleted .b { font-style: italic; opacity: .7; }

/* ---------- نوار نوشتن ---------- */
.composer { padding: 6px 10px calc(8px + var(--safe-b)); background: transparent; position: relative; z-index: 3; }
.composer-in { max-width: 840px; margin: 0 auto; display: flex; align-items: flex-end; gap: 6px; }
.cbox { flex: 1; min-width: 0; background: var(--panel); border-radius: 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.cbar { display: flex; align-items: flex-end; gap: 2px; padding: 3px 4px; }
.cbar textarea { flex: 1; min-width: 0; border: 0; outline: none; background: none; resize: none; max-height: 160px; min-height: 44px; padding: 10px 6px; line-height: 1.55; }
.send { width: 50px; height: 50px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 45%, transparent); transition: transform .12s, background .15s; }
.send:hover { background: var(--accent-d); }
.send:active { transform: scale(.92); }
.send svg { transform: scaleX(-1); }
.ctx-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px 2px 6px; border-bottom: 1px solid var(--line); }
.ctx-bar .q { flex: 1; min-width: 0; border-inline-start: 3px solid var(--accent); padding-inline-start: 9px; font-size: 13.5px; }
.ctx-bar .q b { color: var(--accent); display: block; font-size: 13px; }
.ctx-bar .q span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.ctx-bar > svg { color: var(--accent); }
.blocked-note { text-align: center; color: var(--muted); background: var(--panel); padding: 14px; border-radius: 18px; box-shadow: var(--shadow); max-width: 840px; margin: 0 auto; }

.to-bottom { position: absolute; bottom: 14px; left: 18px; width: 46px; height: 46px; border-radius: 50%; background: var(--panel); color: var(--muted); box-shadow: var(--shadow); display: grid; place-items: center; z-index: 2; transition: opacity .2s, transform .2s; }
.to-bottom.hide { opacity: 0; transform: translateY(10px) scale(.9); pointer-events: none; }
.to-bottom .badge { position: absolute; top: -8px; right: -2px; }

/* اموجی */
.emoji-pop { position: absolute; bottom: calc(100% + 8px); right: 10px; width: min(370px, calc(100vw - 20px)); height: 330px; background: var(--panel); border-radius: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; z-index: 10; animation: rise .15s ease; border: 1px solid var(--line); }
.emoji-tabs { display: flex; overflow-x: auto; border-bottom: 1px solid var(--line); padding: 4px; gap: 2px; scrollbar-width: none; }
.emoji-tabs button { font-size: 20px; padding: 4px 8px; border-radius: 10px; opacity: .55; flex: none; }
.emoji-tabs button.on { opacity: 1; background: var(--hover); }
.emoji-grid { flex: 1; overflow-y: auto; padding: 6px; display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); align-content: start; }
.emoji-grid button { font-size: 26px; height: 42px; border-radius: 10px; line-height: 1; }
.emoji-grid button:hover { background: var(--hover); }
.emoji-grid .cat { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); padding: 6px 4px 2px; }

/* منوی شناور */
.pop-menu { position: fixed; z-index: 60; min-width: 190px; background: var(--panel); border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.22); padding: 6px; animation: rise .12s ease; border: 1px solid var(--line); }
.pop-menu button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 12px; border-radius: 10px; text-align: right; font-size: 14.5px; }
.pop-menu button:hover { background: var(--hover); }
.pop-menu button svg { width: 20px; height: 20px; color: var(--muted); }
.pop-menu button.danger, .pop-menu button.danger svg { color: var(--danger); }

/* ---------- برگه‌ها (Modal) ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(8, 14, 24, .5); z-index: 40; display: grid; place-items: center; padding: 16px; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 440px; max-height: min(720px, calc(100dvh - 32px)); background: var(--panel); border-radius: 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; animation: rise .22s ease; }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px 16px; }
.modal-head h3 { flex: 1; margin: 0; font-size: 17px; }
.modal-body { padding: 4px 18px 18px; overflow-y: auto; }
.modal-body.flush { padding: 0 6px 10px; }
@media (max-width: 560px) {
  .modal-back { place-items: end stretch; padding: 0; }
  .modal { max-width: none; border-radius: 24px 24px 0 0; max-height: 92dvh; padding-bottom: var(--safe-b); animation: up .25s cubic-bezier(.3,.7,.2,1); }
  @keyframes up { from { transform: translateY(100%); } }
}
.profile-card { text-align: center; padding: 6px 0 12px; }
.profile-card .av { margin: 0 auto 12px; }
.profile-card .n { font-size: 20px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.profile-card .s { color: var(--muted); font-size: 13.5px; }
.info-rows { background: var(--panel-2); border-radius: 16px; padding: 4px 14px; margin: 12px 0; text-align: right; }
.info-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.info-row:last-child { border: 0; }
.info-row small { display: block; color: var(--muted); font-size: 12px; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
.av-edit { position: relative; width: 112px; height: 112px; margin: 6px auto 18px; cursor: pointer; }
.av-edit .cam { position: absolute; bottom: 2px; left: 2px; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; border: 3px solid var(--panel); }
.av-edit .cam svg { width: 18px; height: 18px; }
.av-edit .prog { border-radius: 50%; }
.set-row { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.set-row:last-child { border: 0; }
.set-row .t { flex: 1; }
.set-row .t small { display: block; color: var(--muted); font-size: 12.5px; }
.seg { display: flex; background: var(--panel-2); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; padding: 7px 10px; border-radius: 9px; font-size: 13.5px; color: var(--muted); }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.1); font-weight: 600; }
.section-t { font-size: 13px; font-weight: 700; color: var(--accent); margin: 18px 4px 4px; }

/* نمایشگر عکس */
.viewer { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .92); display: flex; flex-direction: column; animation: fade .18s; }
.viewer .bar { display: flex; align-items: center; gap: 6px; padding: calc(10px + var(--safe-t)) 10px 10px; color: #fff; }
.viewer .bar .t { flex: 1; font-size: 14px; }
.viewer .bar .icon-btn { color: #fff; }
.viewer .bar .icon-btn:hover { background: rgba(255,255,255,.12); }
.viewer .stage { flex: 1; display: grid; place-items: center; overflow: hidden; padding: 0 10px calc(10px + var(--safe-b)); }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }

/* پیام کوتاه */
.toasts { position: fixed; top: calc(14px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.toast { background: #1f2937; color: #fff; padding: 10px 18px; border-radius: 14px; font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.25); animation: rise .2s ease; text-align: center; }
.toast.err { background: var(--danger); }
.toast.ok { background: #15803d; }

.drop-zone { position: absolute; inset: 10px; border: 3px dashed var(--accent); border-radius: 22px; background: color-mix(in srgb, var(--panel) 85%, transparent); z-index: 8; display: grid; place-items: center; font-size: 18px; font-weight: 700; color: var(--accent); pointer-events: none; }

.load-more { text-align: center; padding: 8px; }
.load-more .spinner { margin: 0 auto; width: 22px; height: 22px; }

.install-tip { margin: 8px 10px; background: color-mix(in srgb, var(--accent) 10%, var(--panel)); border-radius: 16px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; font-size: 13.5px; }
.install-tip .t { flex: 1; }
.install-tip .btn { height: 36px; padding: 0 14px; font-size: 13.5px; border-radius: 10px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 35%, transparent); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ================= گروه و کانال (فاز ۲) ================= */
.ct { display: inline-flex; color: var(--muted); margin-inline-end: 4px; flex: none; }
.ct svg { width: 16px; height: 16px; stroke-width: 2.2; }
.item.active .ct { color: #fff; }
.mute-i { display: inline-flex; color: var(--muted); margin-inline-start: 4px; flex: none; }
.mute-i svg { width: 14px; height: 14px; }
.badge.muted { background: color-mix(in srgb, var(--muted) 70%, transparent); }
.item .sub b.who { color: var(--text); font-weight: 600; }
.item.active .sub b.who { color: #fff; }
.sys { align-self: center; margin: 6px 0; max-width: 85%; text-align: center; }
.sys span { display: inline-block; background: color-mix(in srgb, var(--panel) 78%, transparent); backdrop-filter: blur(6px); color: var(--muted); font-size: 12.5px; padding: 3px 12px; border-radius: 12px; }
.m.grp { padding-inline-start: 40px; }
.m .sav { position: absolute; inset-inline-start: 0; bottom: 0; cursor: pointer; }
.sname { font-size: 13px; font-weight: 700; margin-bottom: 2px; cursor: pointer; display: flex; align-items: center; }
.sname .tick { width: 14px; height: 14px; }
.meta .views { display: inline-flex; align-items: center; gap: 2px; margin-inline-end: 6px; }
.meta .views svg { width: 14px; height: 14px; stroke-width: 2; }
.bar-btn { box-shadow: var(--shadow); height: 50px; border-radius: 18px; }
.btn.soft.bar-btn { background: var(--panel); color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 2px 8px; }
.chip { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); border-radius: 14px; padding: 2px 10px; font-size: 13px; cursor: pointer; }
.item.pick { cursor: pointer; }
.item.pick input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.slug-in { display: flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: 14px; overflow: hidden; direction: ltr; background: var(--panel); }
.slug-in .pre { display: flex; align-items: center; padding: 0 10px; background: var(--panel-2); color: var(--muted); font-size: 12.5px; white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.slug-in .input { border: 0; border-radius: 0; box-shadow: none !important; }
.link-row { display: flex; align-items: center; gap: 2px; }
.link-row .lk { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--accent); }
.link-row .icon-btn { width: 36px; height: 36px; }
.link-row .icon-btn svg { width: 19px; height: 19px; }
.role-b { font-size: 11.5px; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 8px; padding: 0 8px; flex: none; }
.field .seg { margin-top: 2px; }
.seg button svg { width: 15px; height: 15px; vertical-align: -3px; }

/* ================= فاز ۳: رسانه و امکانات ================= */
.send.mic { background: var(--accent); }
.send.mic svg { transform: none; }
.au { display: flex; align-items: center; gap: 10px; min-width: 230px; max-width: 320px; padding: 2px 0; }
.au-btn { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; position: relative; }
.au-btn svg { width: 20px; height: 20px; fill: currentColor; stroke: none; }
.au-btn.up .ring { position: absolute; inset: -3px; width: 52px; height: 52px; }
.au-btn.up .ring svg { width: 52px; height: 52px; fill: none; stroke: inherit; }
.m.out .au-btn { background: color-mix(in srgb, var(--accent) 85%, #000); }
.au-mid { flex: 1; min-width: 0; }
.wv { display: flex; align-items: center; gap: 2px; height: 30px; cursor: pointer; direction: rtl; }
.wv i { flex: 1; min-width: 2px; max-width: 4px; border-radius: 2px; background: color-mix(in srgb, var(--accent) 35%, transparent); }
.wv i.on { background: var(--accent); }
.m.out .wv i { background: color-mix(in srgb, var(--out-text) 25%, transparent); }
.m.out .wv i.on { background: var(--accent); }
html[data-theme="dark"] .m.out .wv i.on { background: #7cc0ff; }
.au-info { display: flex; align-items: center; gap: 8px; font-size: 12px; opacity: .8; margin-top: 2px; }
.au-sp { font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 8px; background: color-mix(in srgb, var(--text) 10%, transparent); }
.au .fn { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-bar { height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--accent) 22%, transparent); margin: 7px 0 3px; cursor: pointer; position: relative; overflow: hidden; }
.au-bar b { position: absolute; inset-block: 0; right: 0; width: 0; background: var(--accent); border-radius: 2px; }
.au-dl { color: inherit; display: inline-flex; margin-inline-start: auto; }
.au-dl svg { width: 17px; height: 17px; }
.m.has-au .b { padding-top: 8px; }
.img-box.vid { cursor: default; background: #000; }
.img-box.vid video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
.vdur { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.5); color: #fff; font-size: 11.5px; padding: 1px 7px; border-radius: 8px; pointer-events: none; }
.m.has-vid .prog { pointer-events: auto; }
.stk { width: 150px; height: 150px; object-fit: contain; display: block; }
.m.stk-msg .b { background: none !important; box-shadow: none; padding: 0; }
.m.stk-msg .meta { background: color-mix(in srgb, var(--panel) 80%, transparent); border-radius: 10px; padding: 2px 6px; margin: 0; float: none; display: inline-flex; }
.fwd { font-size: 12.5px; color: var(--accent); margin-bottom: 3px; display: flex; align-items: center; gap: 4px; cursor: pointer; }
.fwd svg { width: 15px; height: 15px; }
.rx { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; clear: both; }
.rx-b { display: inline-flex; align-items: center; gap: 3px; background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 14px; padding: 1px 8px; font-size: 14px; line-height: 1.6; }
.rx-b span { font-size: 12px; font-weight: 700; color: var(--accent); }
.rx-b.me { background: var(--accent); }
.rx-b.me span { color: #fff; }
.rx-pick { display: flex; gap: 2px; padding: 4px 4px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.rx-pick button { font-size: 22px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; transition: transform .12s; padding: 0; }
.rx-pick button:hover { transform: scale(1.2); background: var(--hover); }
.rx-pick button.on { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.pop-menu { min-width: 220px; }
.pin-bar { display: flex; align-items: center; gap: 10px; background: var(--panel); border-bottom: 1px solid var(--line); padding: 6px 14px; cursor: pointer; z-index: 2; position: relative; }
.pin-bar > svg { color: var(--accent); width: 20px; height: 20px; }
.pin-bar .t { flex: 1; min-width: 0; border-inline-start: 2px solid var(--accent); padding-inline-start: 8px; font-size: 13px; }
.pin-bar .t b { color: var(--accent); display: block; font-size: 12.5px; }
.pin-bar .t span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.pin-bar .icon-btn { width: 34px; height: 34px; }
.chat-head { position: relative; }
.csearch { position: absolute; inset: 0; background: var(--panel); display: flex; align-items: center; gap: 6px; padding: calc(8px + var(--safe-t)) 10px 8px; z-index: 5; }
.cs-res { position: absolute; top: 100%; left: 0; right: 0; max-height: 55vh; overflow-y: auto; background: var(--panel); box-shadow: var(--shadow); border-radius: 0 0 16px 16px; padding: 4px 6px; }
.s.typing, b.typing { color: var(--accent) !important; font-weight: 600; }
.rec-bar { max-width: 840px; margin: 0 auto; display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 24px; box-shadow: var(--shadow); padding: 4px 4px 4px 4px; }
.rec-bar .icon-btn { color: var(--danger); }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; flex: none; }
@keyframes blink { 50% { opacity: .2; } }
.rec-t { font-weight: 700; min-width: 44px; }
.rec-wave { --lv: 0; flex: none; width: 34px; height: 34px; border-radius: 50%; background: color-mix(in srgb, var(--danger) 25%, transparent); transform: scale(calc(.6 + var(--lv) * .9)); transition: transform .1s; }
.rec-hint { flex: 1; color: var(--muted); font-size: 13.5px; }
.ep-mode { display: flex; gap: 4px; padding: 6px 6px 0; }
.ep-mode button { flex: 1; padding: 6px; border-radius: 10px; font-size: 13.5px; color: var(--muted); }
.ep-mode button.on { background: var(--hover); color: var(--text); font-weight: 600; }
.stk-grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)) !important; }
.stk-b { height: 76px !important; padding: 4px; }
.stk-b img { width: 100%; height: 100%; object-fit: contain; }
.mini-player { display: flex; align-items: center; gap: 6px; padding: 2px 8px; background: var(--panel); border-bottom: 1px solid var(--line); position: relative; z-index: 2; animation: fade .2s; }
.mini-player .icon-btn { width: 36px; height: 36px; color: var(--accent); }
.mini-player .icon-btn svg { width: 18px; height: 18px; }
.mini-player .t { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; min-width: 0; flex: 1; }
.mini-player .tm { font-size: 12px; color: var(--muted); white-space: nowrap; }
.mini-player [data-act="mini-toggle"] svg { fill: currentColor; stroke: none; }
/* پیام ویدیویی دایره‌ای */
.round { width: 240px; height: 240px; border-radius: 50%; overflow: hidden; position: relative; cursor: pointer; background: #000; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.round video { width: 100%; height: 100%; object-fit: cover; display: block; }
.round .prog { border-radius: 50%; }
.round .r-dur { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.45); color: #fff; font-size: 12px; padding: 1px 9px; border-radius: 10px; }
.round .r-snd { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.45); color: #fff; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; }
.round .r-snd svg { width: 16px; height: 16px; }
.round.live .r-snd { display: none; }
.round.live { box-shadow: 0 0 0 3px var(--accent); }
@media (max-width: 420px) { .round { width: 200px; height: 200px; } }
.m.round-msg .meta { margin-top: 4px; }
.rv-back { position: fixed; inset: 0; z-index: 80; background: rgba(5, 10, 20, .82); backdrop-filter: blur(6px); display: grid; place-items: center; animation: fade .2s; }
.rv-box { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.rv-circle { width: min(78vw, 340px); height: min(78vw, 340px); border-radius: 50%; overflow: hidden; position: relative; background: #111; }
.rv-circle video { width: 100%; height: 100%; object-fit: cover; }
.rv-circle video.mirror { transform: scaleX(-1); }
.rv-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); pointer-events: none; }
.rv-ring circle { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset .1s linear; }
.rv-t { color: #fff; font-weight: 700; font-size: 15px; }
.rv-ctl { display: flex; align-items: center; gap: 30px; }
.rv-ctl .icon-btn { color: #fff; background: rgba(255,255,255,.12); width: 50px; height: 50px; }
.rv-rec { width: 74px; height: 74px; border-radius: 50%; border: 4px solid #fff; display: grid; place-items: center; }
.rv-rec span { width: 54px; height: 54px; border-radius: 50%; background: #e5484d; transition: all .2s; }
.rv-rec.on span { width: 28px; height: 28px; border-radius: 7px; }

/* ================= فاز ۴: تماس ================= */
.hd-call svg { width: 21px; height: 21px; }
.callmsg { display: flex; align-items: center; gap: 10px; min-width: 190px; padding: 2px 2px 4px; cursor: pointer; }
.callmsg .cm-ic { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.callmsg .cm-ic svg { width: 20px; height: 20px; }
.callmsg b { display: block; font-size: 14.5px; font-weight: 600; }
.callmsg small { display: block; color: var(--meta); font-size: 12.5px; margin-top: 2px; }
.callmsg .cm-x { color: var(--ok); font-weight: 700; }
.callmsg.bad .cm-x, .callmsg.bad small { color: var(--danger); }
.callmsg.bad .cm-ic { background: var(--danger); }
.m.callm .meta { margin-top: -4px; }
b.missed, #list .item b.missed { color: var(--danger) !important; }

.call-in { position: fixed; inset: 0; z-index: 9000; background: rgba(8, 14, 22, .55); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: tkfade .2s ease; }
.ci-card { background: var(--panel); color: var(--text); border-radius: 24px; padding: 28px 24px 22px; width: min(340px, 100%); text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.ci-card .av.lg { margin: 0 auto 12px; animation: tkpulse 1.6s infinite; }
.ci-name { font-size: 19px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 4px; }
.ci-st { color: var(--muted); margin: 6px 0 22px; font-size: 14px; }
.ci-btns { display: flex; justify-content: center; gap: 22px; }
@keyframes tkpulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 70% { box-shadow: 0 0 0 22px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes tkfade { from { opacity: 0; } to { opacity: 1; } }

.cs-b { border: 0; background: rgba(255,255,255,.16); color: #fff; width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; position: relative; transition: transform .15s, background .15s; font: inherit; }
.cs-b:active { transform: scale(.92); }
.cs-b svg { width: 26px; height: 26px; }
.cs-b span { position: absolute; top: 100%; margin-top: 7px; font-size: 12px; white-space: nowrap; left: 50%; transform: translateX(-50%); opacity: .9; }
.ci-card .cs-b span { color: var(--muted); }
.cs-b.end { background: var(--danger); }
.cs-b.end svg { transform: rotate(135deg); }
.cs-b.ok { background: var(--ok); }
.ci-card .cs-b.ok[data-ci="audio"] { background: color-mix(in srgb, var(--ok) 70%, #555); }
.cs-b.off { background: #fff; color: #17202c; }
.ci-btns, .cs-ctl { padding-bottom: 22px; }

.call-screen { position: fixed; inset: 0; z-index: 8999; background: #0b1119; color: #fff; overflow: hidden; animation: tkfade .2s ease; display: flex; flex-direction: column; }
.call-screen.closing { opacity: 0; transition: opacity .25s; }
.cs-bg { position: absolute; inset: -40px; filter: blur(40px) brightness(.45); display: grid; place-items: center; }
.cs-bg .av.lg { width: 140%; height: 140%; border-radius: 0; font-size: 0; }
.cs-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; display: none; }
.call-screen.has-remote .cs-remote { display: block; }
.call-screen.has-remote.remote-off .cs-remote { display: none; }
.cs-audio { display: none; }
.call-screen.has-remote::before, .call-screen.has-remote::after { content: ""; position: absolute; left: 0; right: 0; z-index: 2; pointer-events: none; }
.call-screen.has-remote::before { top: 0; height: 120px; background: linear-gradient(rgba(0,0,0,.45), transparent); }
.call-screen.has-remote::after { bottom: 0; height: 170px; background: linear-gradient(transparent, rgba(0,0,0,.5)); }
.cs-local { position: absolute; z-index: 3; width: 104px; aspect-ratio: 3/4; object-fit: cover; border-radius: 14px; bottom: calc(132px + var(--safe-b)); left: 16px; background: #222; box-shadow: 0 6px 20px rgba(0,0,0,.4); transform: scaleX(-1); display: none; cursor: pointer; }
.call-screen.is-video .cs-local { display: block; }
.call-screen.env .cs-local { transform: none; }
.call-screen.swap.has-remote:not(.remote-off) .cs-local { inset: 0; width: 100%; height: 100%; border-radius: 0; z-index: 1; box-shadow: none; }
.call-screen.swap.has-remote:not(.remote-off) .cs-remote { inset: auto; bottom: calc(132px + var(--safe-b)); left: 16px; width: 104px; height: auto; aspect-ratio: 3/4; border-radius: 14px; z-index: 3; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.call-screen.local-off .cs-local { display: none; }
.cs-top { position: relative; z-index: 2; text-align: center; padding: calc(56px + var(--safe-t)) 16px 0; transition: all .3s; }
.cs-av .av.lg { margin: 0 auto 14px; }
.cs-name { font-size: 22px; font-weight: 700; display: flex; justify-content: center; align-items: center; gap: 4px; text-shadow: 0 1px 6px rgba(0,0,0,.5); }
.cs-st { margin-top: 6px; opacity: .85; font-size: 15px; font-variant-numeric: tabular-nums; text-shadow: 0 1px 6px rgba(0,0,0,.5); }
.call-screen.has-remote:not(.remote-off) .cs-top { padding-top: calc(18px + var(--safe-t)); }
.call-screen.has-remote:not(.remote-off) .cs-av { display: none; }
.cs-hint { position: relative; z-index: 2; margin: 18px auto 0; max-width: 340px; text-align: center; background: rgba(0,0,0,.4); border-radius: 12px; padding: 10px 14px; font-size: 13.5px; line-height: 1.8; }
.cs-ctl { position: absolute; z-index: 3; bottom: calc(34px + var(--safe-b)); left: 0; right: 0; display: flex; justify-content: center; gap: 20px; }
@media (min-width: 900px) {
  .call-screen { inset: auto 24px 24px auto; width: 400px; height: 600px; border-radius: 22px; box-shadow: 0 24px 70px rgba(0,0,0,.45); }
  .cs-bg { border-radius: 22px; }
}

/* ================= برند (۱.۴.۰) ================= */
.logo-d { display: none; }
html.is-dark .logo-d { display: inline-block; }
html.is-dark .logo-l.has-d { display: none; }
.auth-card .logo.img img { width: 100%; height: 100%; object-fit: contain; }
.side-logo { width: 28px; height: 28px; flex: none; display: inline-flex; }
.side-logo img { width: 28px; height: 28px; object-fit: contain; border-radius: 7px; }

/* ================= فاز ۵ ================= */
/* نظرسنجی */
.m.pollm .b { min-width: min(300px, 74vw); }
.poll { padding: 2px 2px 0; }
.poll .pq { font-weight: 700; font-size: 15px; line-height: 1.6; }
.poll .pk { font-size: 12.5px; color: var(--meta); margin: 2px 0 8px; }
.poll .po { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; padding: 7px 2px; border-radius: 10px; font: inherit; color: inherit; }
.poll button.po:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.poll .pc { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--meta); flex: none; position: relative; }
.poll .pc.sq { border-radius: 6px; }
.poll .pc.on { border-color: var(--accent); background: var(--accent); }
.poll .pc.on::after { content: ""; position: absolute; inset: 3px; border-radius: inherit; background: #fff; transform: scale(.5); }
.poll .po.res { align-items: flex-start; cursor: default; }
.poll .pp { font-weight: 700; font-size: 13px; min-width: 38px; padding-top: 1px; }
.poll .pt { flex: 1; min-width: 0; }
.poll .pl { display: inline-flex; align-items: center; gap: 4px; line-height: 1.5; }
.poll .pl svg { width: 15px; height: 15px; color: var(--accent); }
.poll .pt i { display: block; height: 4px; border-radius: 3px; background: color-mix(in srgb, var(--accent) 45%, transparent); margin-top: 5px; transition: width .4s; }
.poll .po.me .pt i { background: var(--accent); }
.poll .pf { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--meta); margin-top: 6px; }
.poll .pf a { color: var(--accent); }
.btn.sm { height: 34px; padding: 0 14px; border-radius: 10px; font-size: 13px; }
.btn.sm:disabled { opacity: .5; }
.poll-opt { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.poll-opt .input { height: 44px; }
/* زمان‌دار */
.sched-bar { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 16px; background: var(--panel); border-top: 1px solid var(--line); color: var(--accent); font-size: 13.5px; text-align: start; }
.sched-bar svg { width: 18px; height: 18px; flex: none; }
.sched-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
button.chip { border: 0; padding: 7px 14px; font: inherit; font-size: 13px; }
.sched-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 10px; }
.sched-row .field { margin-bottom: 0; }
.sched-item { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.sched-item .si-when { display: flex; align-items: center; gap: 6px; color: var(--accent); font-size: 13px; font-weight: 600; }
.sched-item .si-when svg { width: 16px; height: 16px; }
.sched-item .si-body { margin: 6px 0 8px; white-space: pre-wrap; word-break: break-word; }
.sched-item .si-act { display: flex; gap: 8px; }
/* بایگانی و پوشه‌ها */
.arch-av { --c: #8a99ab; display: grid; place-items: center; }
.arch-av svg { width: 24px; height: 24px; color: #fff; }
.arch-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer; font-weight: 700; border-bottom: 1px solid var(--line); }
.arch-head svg { width: 20px; height: 20px; }
.arch-head small { flex-basis: 100%; font-weight: 400; color: var(--muted); font-size: 12px; }
.ftabs { display: flex; gap: 4px; overflow-x: auto; padding: 0 8px 6px; scrollbar-width: none; flex: none; }
.ftabs::-webkit-scrollbar { display: none; }
.ftab { flex: none; padding: 6px 12px; border-radius: 16px; font-size: 13.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.ftab.on { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.ftab b { background: var(--accent); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 6px; min-width: 18px; text-align: center; }
.ftab.ed svg { width: 16px; height: 16px; }
.folder-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.folder-row > svg { width: 22px; height: 22px; color: var(--accent); flex: none; }
.folder-row .t { flex: 1; }
.folder-row .t small { display: block; color: var(--muted); font-size: 12px; }
.chk-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; cursor: pointer; }
.chk-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.pick-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; }
/* رسانه‌های مشترک */
.mtabs { display: flex; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 2; }
.mtabs button { flex: 1; padding: 12px 4px; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; display: inline-flex; justify-content: center; gap: 4px; }
.mtabs button.on { color: var(--accent); border-color: var(--accent); }
.mtabs b { font-weight: 400; font-size: 12px; opacity: .8; }
.mbox.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 2px; }
.mcell { aspect-ratio: 1; position: relative; overflow: hidden; background: var(--panel-2); }
.mcell img, .mcell video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mcell .vb { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }
.mcell .vb svg { width: 30px; height: 30px; filter: drop-shadow(0 1px 3px rgba(0,0,0,.6)); }
.mrow { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.mrow .ic { width: 42px; height: 42px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); display: grid; place-items: center; flex: none; }
.mrow .ic svg { width: 20px; height: 20px; }
.mrow .t { flex: 1; min-width: 0; }
.mrow .t b { display: block; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow .t small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ol.steps { padding-inline-start: 20px; line-height: 2; margin: 0 0 14px; }
.seg button { flex: 1; }

/* ================= اپ اندروید و لودر شروع (فاز ۶) ================= */
.in-app [data-m="install"], .in-app .install-tip { display: none !important; }
.boot-splash.custom { background: var(--sb); color: var(--sf); position: fixed; inset: 0; gap: 0; }
.boot-splash.custom .bs-logo { width: var(--ls, 112px); height: var(--ls, 112px); object-fit: contain; }
.boot-splash.custom .bs-t { font-size: 22px; font-weight: 800; margin-top: 18px; text-align: center; padding: 0 24px; }
.boot-splash.custom .bs-s { font-size: 14px; opacity: .75; margin-top: 6px; text-align: center; padding: 0 32px; }
.boot-splash.custom .bs-l { margin-top: 34px; }
.bs-spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--lc) 25%, transparent); border-top-color: var(--lc); animation: spin .8s linear infinite; }
.bs-bar { width: 160px; height: 4px; border-radius: 4px; background: color-mix(in srgb, var(--lc) 22%, transparent); overflow: hidden; position: relative; }
.bs-bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 40%; border-radius: 4px; background: var(--lc); animation: bsbar 1.1s ease-in-out infinite; }
@keyframes bsbar { 0% { transform: translateX(-110%); } 100% { transform: translateX(260%); } }
.bs-dots { display: flex; gap: 8px; }
.bs-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--lc); animation: bsdot 1.1s ease-in-out infinite; }
.bs-dots i:nth-child(2) { animation-delay: .18s; }
.bs-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes bsdot { 0%, 80%, 100% { transform: scale(.55); opacity: .35; } 40% { transform: scale(1); opacity: 1; } }

/* ================= کانال اسپانسری (عضویت اجباری) ================= */
.sponsor-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; color: var(--muted); font-size: 13.5px; }
.sponsor-bar > svg { width: 20px; height: 20px; color: var(--accent); flex: none; }
.sponsor-bar span { flex: 1; }
.sponsor-bar .bar-btn { width: auto; padding: 0 14px; }
.sponsor-note { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--text); font-size: 13.5px; }
.sponsor-note svg { width: 20px; height: 20px; color: var(--accent); flex: none; }

/* ---------- سرویس‌ها و مینی‌اپ‌ها (روستاگرام) ---------- */
.svc-wrap { padding: 6px 16px 18px; min-height: 120px; }
.svc-wrap > .spinner { margin: 40px auto; }
.svc-cat { font-weight: 800; font-size: 13px; color: var(--muted); margin: 14px 2px 8px; }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.svc { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: inherit; font: inherit; cursor: pointer; text-align: center; transition: transform .12s, box-shadow .12s; }
.svc:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.svc:disabled { opacity: .6; }
.svc-ic { width: 52px; height: 52px; border-radius: 16px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 800; overflow: hidden; }
.svc-ic img { width: 100%; height: 100%; object-fit: cover; }
.svc b { font-size: 13px; line-height: 1.5; }
.svc small { font-size: 11px; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.miniapp { position: fixed; inset: 0; z-index: 60; background: var(--panel); display: flex; flex-direction: column; animation: maUp .22s cubic-bezier(.3,.7,.2,1); }
@keyframes maUp { from { transform: translateY(24px); opacity: 0; } }
.miniapp-head { display: flex; align-items: center; gap: 8px; padding: calc(6px + var(--safe-t)) 8px 6px; border-bottom: 1px solid var(--line); }
.miniapp-head b { flex: 1; font-size: 15px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.miniapp-body { position: relative; flex: 1; }
.miniapp-body iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.miniapp-body > .spinner { position: absolute; top: 40%; left: 50%; margin-left: -14px; z-index: 1; }
