/* هاتف الأعضاء — التصميم (خفيف: بلا تأثيرات ضبابية أو حركات مستمرة ثقيلة) */
:root {
  --bg: #0b1220; --bg2: #0e1627; --card: #121c30; --card2: #182439; --line: rgba(148, 163, 184, .14);
  --text: #e8edf5; --muted: #9aa8bd; --faint: #66758c;
  --green: #10b981; --green-d: #059669; --red: #ef4444; --red-d: #dc2626; --blue: #3b82f6; --amber: #f59e0b;
  --accent: #10b981; --accent-soft: rgba(16, 185, 129, .14);
  --radius: 16px; --tabbar: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f5fa; --bg2: #e9edf5; --card: #ffffff; --card2: #f1f4f9; --line: rgba(15, 23, 42, .10);
  --text: #0f172a; --muted: #52607a; --faint: #8a97ab; --accent-soft: rgba(16, 185, 129, .12);
  --shadow: 0 10px 30px rgba(15, 23, 42, .12);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f5fa; --bg2: #e9edf5; --card: #ffffff; --card2: #f1f4f9; --line: rgba(15, 23, 42, .10);
    --text: #0f172a; --muted: #52607a; --faint: #8a97ab; --accent-soft: rgba(16, 185, 129, .12);
    --shadow: 0 10px 30px rgba(15, 23, 42, .12);
    color-scheme: light;
  }
}

:root { --key: #1c2a42; }
:root[data-theme="light"] { --key: #e2e8f0; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { --key: #e2e8f0; } }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Naskh Arabic", "Geeza Pro", sans-serif;
  font-size: 15px; line-height: 1.45; overflow: hidden; overscroll-behavior: none;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { width: 22px; height: 22px; display: block; flex-shrink: 0; }
[data-i] { display: inline-flex; align-items: center; justify-content: center; }
input, select {
  width: 100%; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  outline: none; transition: border-color .15s;
}
input:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: var(--faint); }

.app { position: relative; height: 100%; max-width: 560px; margin: 0 auto; background: var(--bg); }
@media (min-width: 700px) {
  body { background: var(--bg2); }
  .app { border-inline: 1px solid var(--line); box-shadow: var(--shadow); }
}
.scr { position: absolute; inset: 0; display: flex; flex-direction: column; }

/* ───── عام ───── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; padding: 11px 18px;
  font-weight: 700; transition: transform .1s, background .15s, opacity .15s; min-height: 44px;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-d); }
.btn.ghost { background: var(--card2); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--accent); }
.btn.danger { color: var(--red); }
.btn.big { width: 100%; padding: 14px; font-size: 16px; }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { width: 18px; height: 18px; }
.link { color: var(--accent); font-weight: 600; text-align: center; padding: 8px; text-decoration: none; display: block; }
.link.small { font-size: 13px; color: var(--muted); font-weight: 500; }
.msg { min-height: 20px; font-size: 13.5px; text-align: center; color: var(--red); }
.msg.ok { color: var(--green); }
.note { color: var(--muted); font-size: 13.5px; margin: 0 0 10px; }
.note.small { font-size: 12px; margin: 6px 0 0; }
.sub { color: var(--muted); font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 48px 28px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty b { color: var(--text); font-size: 17px; }
.empty p { margin: 0 0 8px; font-size: 14px; }
.big-ic { width: 64px; height: 64px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); margin-bottom: 6px; }
.big-ic svg { width: 30px; height: 30px; }

/* ───── صورة العضو (الأحرف الأولى) ───── */
.av {
  --c: #6366f1; width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: #fff; font-weight: 800; font-size: 16px; background: var(--c); position: relative; letter-spacing: 0;
  user-select: none;
}
.av.sm { width: 36px; height: 36px; font-size: 13px; }
.av.lg { width: 84px; height: 84px; font-size: 30px; }
.av.xl { width: 116px; height: 116px; font-size: 40px; }
.av[data-c="0"] { --c: #6366f1; } .av[data-c="1"] { --c: #0ea5e9; } .av[data-c="2"] { --c: #10b981; }
.av[data-c="3"] { --c: #f59e0b; } .av[data-c="4"] { --c: #ec4899; } .av[data-c="5"] { --c: #8b5cf6; }
.av[data-c="6"] { --c: #06b6d4; } .av[data-c="7"] { --c: #ef4444; } .av[data-c="8"] { --c: #84cc16; }
.av .pd {
  position: absolute; bottom: 0; left: 0; width: 13px; height: 13px; border-radius: 50%; border: 2.5px solid var(--bg);
  background: var(--faint);
}
.av .pd.online { background: var(--green); }
.av .pd.busy { background: var(--red); }
.av.lg .pd { width: 18px; height: 18px; bottom: 3px; left: 3px; }

/* ───── شاشة البدء ───── */
.boot { align-items: center; justify-content: center; gap: 10px; }
.boot-logo, .brand-logo {
  width: 84px; height: 84px; border-radius: 26px; background: linear-gradient(145deg, #10b981, #0e7490); color: #fff;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 14px 34px rgba(16, 185, 129, .3);
}
.boot-logo svg, .brand-logo svg { width: 40px; height: 40px; }
.boot-name { font-weight: 800; font-size: 20px; }
.boot-msg { color: var(--muted); font-size: 14px; text-align: center; padding: 0 30px; }

/* ───── الدخول ───── */
.auth { overflow-y: auto; align-items: center; padding: calc(24px + var(--safe-t)) 18px calc(24px + var(--safe-b)); }
.auth-card { width: 100%; max-width: 400px; margin: auto; }
.brand { text-align: center; margin-bottom: 22px; }
.brand .brand-logo { margin: 0 auto 14px; }
.brand h1 { margin: 0; font-size: 24px; }
.brand p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.fld { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--muted); font-weight: 600; }
.fld input, .fld select { color: var(--text); font-weight: 500; font-size: 16px; }
.inv-hello { background: var(--accent-soft); border: 1px solid rgba(16, 185, 129, .35); border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.inv-hello b { color: var(--accent); }
.auth-foot { margin-top: 22px; color: var(--faint); font-size: 12.5px; display: flex; gap: 6px; align-items: center; justify-content: center; text-align: center; }
.auth-foot svg { width: 15px; height: 15px; }

.other { align-items: center; justify-content: center; padding: 24px; text-align: center; }
.other-card { max-width: 360px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.other-card h2 { margin: 0; font-size: 20px; }
.other-card p { color: var(--muted); margin: 0 0 8px; }

/* ───── الشاشة الرئيسية ───── */
.main { padding-top: var(--safe-t); }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 16px 8px; }
.top-title { flex: 1; min-width: 0; }
.top-title h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: 0; }
.top-title small { color: var(--muted); font-size: 12.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-btn { position: relative; border-radius: 50%; }
.me-btn .conn { position: absolute; bottom: -1px; left: -1px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--bg); background: var(--green); }
.me-btn .conn.down { background: var(--amber); }
.top-actions { display: flex; gap: 6px; }
.top-actions button { color: var(--accent); font-weight: 700; font-size: 14px; padding: 8px 10px; border-radius: 10px; }
.top-actions button:hover { background: var(--accent-soft); }
.top-actions button.danger { color: var(--red); }

.banners { display: flex; flex-direction: column; gap: 8px; padding: 0 12px; }
.banners:empty { display: none; }
.banner {
  display: flex; align-items: center; gap: 10px; border-radius: 14px; padding: 10px 12px; font-size: 13.5px;
  background: var(--card); border: 1px solid var(--line);
}
.banner .bi { width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.banner .bi svg { width: 18px; height: 18px; }
.banner .bt { flex: 1; min-width: 0; }
.banner .bt b { display: block; font-size: 14px; }
.banner .bt span { color: var(--muted); }
.banner.warn .bi { background: rgba(245, 158, 11, .15); color: var(--amber); }
.banner .bx { color: var(--faint); padding: 4px; }
.banner .bx svg { width: 16px; height: 16px; }
.banner .btn { min-height: 36px; padding: 6px 12px; font-size: 13px; }

.pill-call {
  margin: 0 12px 8px; background: var(--green); color: #fff; border-radius: 14px; padding: 9px 14px; display: flex;
  align-items: center; gap: 10px; font-weight: 700; font-size: 14px; cursor: pointer;
}
.pill-call .pc-dot { width: 9px; height: 9px; border-radius: 50%; background: #fff; animation: blink 1.4s ease-in-out infinite; }
.pill-call .pc-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill-call .pc-time { font-variant-numeric: tabular-nums; direction: ltr; }
@keyframes blink { 50% { opacity: .35; } }

.tabs { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 16px; }
.tab { padding: 4px 0 0; }

.tabbar {
  display: flex; border-top: 1px solid var(--line); background: var(--bg); padding-bottom: var(--safe-b);
  height: calc(var(--tabbar) + var(--safe-b)); flex-shrink: 0;
}
.tabbar button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--faint);
  position: relative; font-size: 11px; font-weight: 700; min-width: 0;
}
.tabbar button em { font-style: normal; white-space: nowrap; }
.tabbar button.on { color: var(--accent); }
.tabbar svg { width: 24px; height: 24px; }
.badge {
  position: absolute; top: 5px; right: calc(50% - 26px); min-width: 19px; height: 19px; border-radius: 10px; background: var(--red);
  color: #fff; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 5px;
  font-style: normal; border: 2px solid var(--bg);
}

/* ───── القوائم ───── */
.list { display: flex; flex-direction: column; }
.sec-h { position: sticky; top: 0; z-index: 1; background: var(--bg); color: var(--muted); font-size: 12.5px; font-weight: 800; padding: 8px 18px 4px; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 9px 16px; min-height: 64px; cursor: pointer; text-align: right; width: 100%;
  border-bottom: 1px solid var(--line); background: transparent;
}
.row:hover { background: var(--card); }
.row:active { background: var(--card2); }
.row .rm { flex: 1; min-width: 0; }
.row .rn { font-weight: 700; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .rs { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 5px; }
.row .rs svg { width: 14px; height: 14px; }
.row .re { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; flex-shrink: 0; }
.row .ext { font-variant-numeric: tabular-nums; direction: ltr; font-weight: 700; color: var(--muted); }
.row.missed .rn { color: var(--red); }
.row.off { opacity: .55; }
.row .unseen { width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.ibtn { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--accent); }
.ibtn:hover { background: var(--accent-soft); }
.ibtn svg { width: 20px; height: 20px; }
.ibtn.star.on { color: var(--amber); }
.ibtn.del { color: var(--red); }
.dir-in { color: var(--green); } .dir-out { color: var(--blue); } .dir-miss { color: var(--red); }

.seg { display: flex; background: var(--card2); border-radius: 12px; padding: 3px; margin: 4px 16px 10px; }
.seg button { flex: 1; padding: 8px; border-radius: 9px; font-weight: 700; font-size: 13.5px; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }

.search { margin: 4px 16px 8px; position: relative; }
.search > span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search svg { width: 18px; height: 18px; }
.search input { padding-right: 40px; }
.chips { display: flex; gap: 6px; padding: 0 16px 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; padding: 6px 12px; border-radius: 999px; background: var(--card2); border: 1px solid var(--line); font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.chip.on { background: var(--accent-soft); border-color: rgba(16, 185, 129, .45); color: var(--accent); }

/* ───── المفضلة ───── */
.fav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; padding: 8px 16px; }
.fav {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px 12px; border-radius: 18px;
  background: var(--card); border: 1px solid var(--line); text-align: center; cursor: pointer; min-width: 0;
}
.fav:active { transform: scale(.97); }
.fav .av { width: 62px; height: 62px; font-size: 22px; }
.fav .fn { font-weight: 700; font-size: 14px; line-height: 1.3; max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.fav .fs { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.fav .fi { position: absolute; top: 6px; left: 6px; width: 30px; height: 30px; border-radius: 50%; color: var(--faint); display: flex; align-items: center; justify-content: center; }
.fav .fi svg { width: 17px; height: 17px; }
.fav .fi:hover { color: var(--accent); background: var(--accent-soft); }

/* ───── لوحة الأرقام ───── */
.kp { display: flex; flex-direction: column; align-items: center; padding: 8px 16px 12px; max-width: 360px; margin: 0 auto; }
.kp-display { text-align: center; min-height: 92px; display: flex; flex-direction: column; justify-content: center; width: 100%; }
.kp-num { font-size: 40px; font-weight: 300; letter-spacing: 2px; min-height: 52px; font-variant-numeric: tabular-nums; }
.kp-match { color: var(--muted); font-size: 14px; min-height: 22px; }
.kp-match b { color: var(--accent); }
.kp-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 22px; margin: 10px 0 18px; }
.kp-keys button {
  width: 76px; height: 76px; border-radius: 50%; background: var(--key); font-size: 32px; font-weight: 400;
  display: flex; align-items: center; justify-content: center; transition: background .1s;
}
.kp-keys button:active { background: var(--line); }
.kp-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; align-items: center; }
.kp-call { width: 76px; height: 76px; border-radius: 50%; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; }
.kp-call svg { width: 32px; height: 32px; }
.kp-call:active { background: var(--green-d); }
.kp-side { width: 76px; height: 76px; border-radius: 50%; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.kp-side svg { width: 28px; height: 28px; }
.kp-side:hover { color: var(--text); }

/* ───── الأوراق المنبثقة ───── */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; background: rgba(2, 6, 23, .55); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; background: var(--bg);
  border-radius: 22px 22px 0 0; padding: 22px 18px calc(22px + var(--safe-b)); box-shadow: var(--shadow);
  animation: sheetIn .22s ease-out;
}
.sheet.tall { max-height: 94vh; }
@keyframes sheetIn { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-x { position: absolute; top: 12px; left: 12px; width: 36px; height: 36px; border-radius: 50%; background: var(--card2); color: var(--muted); display: flex; align-items: center; justify-content: center; }
.sheet-x svg { width: 18px; height: 18px; }
.ct-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding-top: 4px; }
.ct-head h3 { margin: 8px 0 0; font-size: 22px; }
.pres { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.pres i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; }
.pres.online i { background: var(--green); } .pres.busy i { background: var(--red); }
.qa-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0 14px; }
.qa { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); font-weight: 700; font-size: 13px; }
.qa em { font-style: normal; }
.qa svg { width: 24px; height: 24px; }
.qa.green { color: var(--green); } .qa.blue { color: var(--blue); }
.qa.on { color: var(--amber); }
.qa:disabled { opacity: .45; }
.kv { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.kv > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv > div:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.ct-hist { margin-top: 14px; }
.ct-hist .h { color: var(--muted); font-size: 12.5px; font-weight: 800; margin: 0 4px 6px; }
.ct-hist .hr { display: flex; justify-content: space-between; font-size: 13.5px; padding: 6px 4px; border-bottom: 1px dashed var(--line); gap: 8px; }
.ct-hist .hr span:last-child { color: var(--muted); direction: ltr; }

.me-head { display: flex; align-items: center; gap: 14px; padding: 4px 4px 0; }
.me-head h3 { margin: 0; font-size: 20px; }
.me-ext { margin: 12px 0 14px; background: var(--accent-soft); color: var(--text); border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.me-ext b { color: var(--accent); font-size: 18px; margin-right: 6px; }
.grp { background: var(--card); border: 1px solid var(--line); border-radius: 16px; margin-bottom: 12px; overflow: hidden; }
.grp-t { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-weight: 800; font-size: 14.5px; border-bottom: 1px solid var(--line); }
.grp-t svg { width: 18px; height: 18px; color: var(--accent); }
.grp-b { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.grp-b .seg { margin: 0; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.meter { height: 8px; border-radius: 6px; background: var(--card2); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--green); transition: width .08s linear; }
.share { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.qr-box { background: #fff; border-radius: 14px; padding: 10px; width: 190px; height: 190px; }
.qr-box svg, .qr-box img { width: 100%; height: 100%; }
.share-link { display: flex; align-items: center; gap: 8px; max-width: 100%; }
.share-link code { font-size: 12px; background: var(--card2); padding: 6px 10px; border-radius: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 250px; }
.me-foot { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 6px; }
.me-foot .btn svg { width: 18px; height: 18px; }
.ver { color: var(--faint); font-size: 12px; direction: ltr; }

/* ───── شاشات المكالمة ───── */
.call-scr {
  position: fixed; inset: 0; z-index: 60; color: #fff; display: flex; flex-direction: column; align-items: center;
  background: #0a1020; overflow: hidden; padding: calc(12px + var(--safe-t)) 18px calc(18px + var(--safe-b));
}
.call-bg { position: absolute; inset: 0; background: radial-gradient(120% 80% at 50% 0%, #134e4a 0%, #0b1a2e 55%, #070d1a 100%); z-index: 0; }
.incoming .call-bg { background: radial-gradient(120% 80% at 50% 0%, #065f46 0%, #0b2a2e 50%, #070d1a 100%); }
.call-scr > * { position: relative; z-index: 1; }
.call-scr .sub { color: rgba(255, 255, 255, .72); font-size: 14px; }
.call-top, .inc-top { width: 100%; max-width: 560px; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
.inc-top { justify-content: center; }
.lock-tag { display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, .12); color: #d1fae5; border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 700; }
.lock-tag em { font-style: normal; }
.lock-tag svg { width: 14px; height: 14px; }
.lock-tag.verified { background: rgba(16, 185, 129, .35); color: #fff; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; display: flex; align-items: center; justify-content: center; }
.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 16px; width: 42px; justify-content: center; }
.bars i { width: 4px; border-radius: 2px; background: rgba(255, 255, 255, .25); }
.bars i:nth-child(1) { height: 5px; } .bars i:nth-child(2) { height: 8px; } .bars i:nth-child(3) { height: 11px; } .bars i:nth-child(4) { height: 15px; }
.bars[data-q="1"] i:nth-child(-n+1), .bars[data-q="2"] i:nth-child(-n+2), .bars[data-q="3"] i:nth-child(-n+3), .bars[data-q="4"] i { background: #34d399; }
.bars[data-q="1"] i:nth-child(1) { background: #f87171; }
.bars[data-q="2"] i:nth-child(-n+2) { background: #fbbf24; }
.call-peer { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; width: 100%; max-width: 560px; min-height: 0; }
.call-peer h2 { margin: 14px 0 0; font-size: 28px; font-weight: 800; line-height: 1.25; word-break: break-word; }
.call-peer .status { font-size: 16px; color: #a7f3d0; font-variant-numeric: tabular-nums; min-height: 24px; }
.call-peer .status.err { color: #fecaca; }
.flags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; min-height: 28px; }
.flags span { display: inline-flex; align-items: center; gap: 5px; background: rgba(0, 0, 0, .35); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; }
.flags svg { width: 14px; height: 14px; }
.ring { position: relative; border-radius: 50%; }
.ring::before, .ring::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid rgba(52, 211, 153, .55);
  animation: ringOut 2.2s ease-out infinite; pointer-events: none;
}
.ring::after { animation-delay: 1.1s; }
@keyframes ringOut { from { transform: scale(1); opacity: .9; } to { transform: scale(1.55); opacity: 0; } }
.inc-more { background: rgba(0, 0, 0, .3); border-radius: 12px; padding: 8px 14px; font-size: 13px; margin-bottom: 14px; }
.inc-actions { display: flex; justify-content: space-around; align-items: flex-start; width: 100%; max-width: 420px; margin-bottom: 18px; }
.inc-actions .act { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.inc-actions em { font-style: normal; }
.round { width: 76px; height: 76px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; }
.round svg { width: 34px; height: 34px; }
.round.green { background: var(--green); box-shadow: 0 10px 26px rgba(16, 185, 129, .45); }
.round.red { background: var(--red); box-shadow: 0 10px 26px rgba(239, 68, 68, .4); }
.round.blue { background: var(--blue); }
.round.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.07); } }

.rv { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; z-index: 0; display: none; }
.call-scr.video .rv { display: block; }
.call-scr.video .call-bg { display: none; }
.call-scr.video .call-peer { justify-content: flex-start; padding-top: 6px; flex: 0 0 auto; }
.call-scr.video .call-peer .av, .call-scr.video .call-peer .sub { display: none; }
.call-scr.video .call-peer h2 { font-size: 20px; margin-top: 4px; text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
.call-scr.video .call-peer .status { text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
.call-scr.video .call-ctrls { margin-top: auto; }
.rv.contain { object-fit: contain; }
.lv {
  position: absolute; z-index: 3; top: calc(68px + var(--safe-t)); left: 14px; width: 104px; height: 140px; object-fit: cover;
  border-radius: 14px; background: #111; border: 2px solid rgba(255, 255, 255, .2); box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
  touch-action: none; cursor: grab;
}
.lv.mirror { transform: scaleX(-1); }
@media (min-width: 700px) { .lv { width: 220px; height: 140px; } }

.call-ctrls { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.cgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 10px; width: 100%; }
.cbtn { display: flex; flex-direction: column; align-items: center; gap: 7px; color: #fff; font-size: 12.5px; font-weight: 600; }
.cbtn em { font-style: normal; white-space: nowrap; }
.cbtn .ic { width: 64px; height: 64px; border-radius: 50%; background: rgba(255, 255, 255, .14); display: flex; align-items: center; justify-content: center; transition: background .15s; }
.cbtn .ic svg { width: 26px; height: 26px; }
.cbtn.on .ic { background: #fff; color: #0b1220; }
.cbtn.warn .ic { background: rgba(239, 68, 68, .85); }
.cbtn:disabled { opacity: .4; }
.end-btn { width: 74px; height: 74px; border-radius: 50%; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 26px rgba(239, 68, 68, .45); }
.end-btn svg { width: 34px; height: 34px; }
.end-btn:active { background: var(--red-d); }
.call-scr.ended .call-ctrls, .call-scr.ended .lv, .call-scr.ended .rv { display: none; }
.call-end { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 40px; }
.ce-status { font-size: 18px; font-weight: 800; }
.ce-sub { color: rgba(255, 255, 255, .7); font-size: 14px; text-align: center; max-width: 320px; }
.ce-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.ce-btns .btn { background: rgba(255, 255, 255, .14); color: #fff; }
.ce-btns .btn.primary { background: var(--green); }

.sec-sheet { position: absolute; inset: 0; z-index: 5; background: rgba(2, 6, 23, .72); display: flex; align-items: flex-end; justify-content: center; }
.sec-card { position: relative; width: 100%; max-width: 480px; background: #0f172a; border-radius: 22px 22px 0 0; padding: 22px 18px calc(22px + var(--safe-b)); display: flex; flex-direction: column; gap: 12px; animation: sheetIn .22s ease-out; }
.sec-card h3 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 18px; }
.sec-card h3 svg { color: #34d399; }
.sec-card .note { color: #cbd5e1; margin: 0; }
.sas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sas .e { background: rgba(255, 255, 255, .06); border-radius: 14px; padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sas .e em { font-style: normal; font-size: 32px; line-height: 1.1; }
.sas .e small { font-size: 12px; color: #cbd5e1; }
.sas-digits { text-align: center; font-size: 22px; font-weight: 800; letter-spacing: 2px; font-variant-numeric: tabular-nums; color: #a7f3d0; }
.sec-info { font-size: 12.5px; color: #94a3b8; display: flex; flex-direction: column; gap: 4px; }
.sec-info div { display: flex; justify-content: space-between; gap: 8px; }
.sec-info b { color: #e2e8f0; font-weight: 600; unicode-bidi: plaintext; text-align: left; }

/* ───── رسائل سريعة ───── */
.toasts { position: fixed; z-index: 90; left: 0; right: 0; bottom: calc(var(--tabbar) + 16px + var(--safe-b)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: #111827; color: #f9fafb; border-radius: 12px; padding: 10px 16px; font-size: 14px; box-shadow: 0 8px 22px rgba(0, 0, 0, .35); max-width: 440px; text-align: center; animation: toastIn .2s ease-out; pointer-events: auto; }
.toast.err { background: #7f1d1d; }
.toast.ok { background: #065f46; }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-height: 640px) {
  .av.xl { width: 88px; height: 88px; font-size: 30px; }
  .cbtn .ic { width: 56px; height: 56px; }
  .call-ctrls { gap: 14px; }
  .cgrid { gap: 10px; }
  .kp-keys button, .kp-call, .kp-side { width: 64px; height: 64px; }
  .kp-keys { gap: 10px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ───── اسم المستخدم والاتصال المباشر ───── */
input[dir="ltr"]:placeholder-shown { direction: rtl; }
.un { direction: ltr; unicode-bidi: isolate; color: var(--accent); font-weight: 700; }
.row .rs .un { flex-shrink: 0; }
.du { padding: 4px 16px 16px; max-width: 480px; margin: 0 auto; }
.du-box { display: flex; align-items: center; gap: 0; background: var(--card2); border: 1px solid var(--line); border-radius: 16px;
  padding: 0 6px 0 14px; transition: border-color .15s; direction: ltr; }
.du-box:focus-within { border-color: var(--accent); }
.du-at { font-size: 22px; font-weight: 800; color: var(--accent); padding-inline-end: 4px; }
.du-box input { border: 0; background: none; padding: 14px 6px; font-size: 20px; font-weight: 600; letter-spacing: .3px; min-width: 0; }
.du-box input:focus { border: 0; }
.du-box input:focus-visible { outline: none; }
.du-clear { width: 36px; height: 36px; border-radius: 50%; color: var(--muted); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.du-clear svg { width: 18px; height: 18px; }
.du-actions { margin: 14px auto 6px; justify-content: center; width: max-content; }
.du-actions > span.kp-side { visibility: hidden; }
.kp-call:disabled { background: var(--card2); color: var(--faint); cursor: default; }
.du-match { display: flex; align-items: center; gap: 12px; background: var(--accent-soft); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px 14px; margin: 10px 0 4px; cursor: pointer; }
.du-match .rm { flex: 1; min-width: 0; }
.du-match .rn { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.du-match .rs { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.du-hint { color: var(--muted); font-size: 13.5px; text-align: center; margin: 12px 4px 6px; }
.du .list { margin: 0 -16px; }
.me-ext2 { color: var(--muted); font-size: 13px; margin-right: 8px; }
.me-ext2 span { font-weight: 700; }
/* ───── تثبيت التطبيق ───── */
.ins-head { text-align: center; padding: 6px 8px 4px; }
.ins-icon { width: 72px; height: 72px; border-radius: 18px; box-shadow: var(--shadow); }
.ins-head h3 { margin: 12px 0 6px; font-size: 18px; }
.steps { list-style: none; counter-reset: st; margin: 14px 0 6px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.steps li { counter-increment: st; display: flex; align-items: center; gap: 12px; background: var(--card2); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px; font-size: 14.5px; }
.steps li::before { content: counter(st); width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff;
  font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.steps li .si { color: var(--accent); flex-shrink: 0; }
.steps li b { color: var(--text); }
#sheetInstall .btn.big { margin-top: 12px; }
