/* هاتف الأعضاء — التصميم (خفيف: بلا تأثيرات ضبابية أو حركات مستمرة ثقيلة) */
: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, textarea { 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.small { padding: 16px 20px; font-size: 13px; }
.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; }
#sheetPick { z-index: 44; }          /* منتقي الأعضاء/النيابات يُفتح فوق «معلومات المجموعة» */
#sheetAct { z-index: 46; }           /* قائمة الإجراءات فوق أي ورقة مفتوحة */
.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-auto-flow: column; grid-auto-columns: 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.teal { color: #14b8a6; }
.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; }

/* ═══════════════ الرسائل ═══════════════ */
:root {
  --chat-bg: #0a1322; --bub-them: #19253b; --bub-me: #0c5a48; --bub-me-text: #ecfdf5;
  --bub-meta: rgba(226, 232, 240, .62); --bub-soft: rgba(0, 0, 0, .2); --tick-read: #38bdf8;
}
:root[data-theme="light"] {
  --chat-bg: #ebe6de; --bub-them: #ffffff; --bub-me: #d9fdd3; --bub-me-text: #0f172a;
  --bub-meta: rgba(15, 23, 42, .5); --bub-soft: rgba(15, 23, 42, .06); --tick-read: #0ea5e9;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --chat-bg: #ebe6de; --bub-them: #ffffff; --bub-me: #d9fdd3; --bub-me-text: #0f172a;
    --bub-meta: rgba(15, 23, 42, .5); --bub-soft: rgba(15, 23, 42, .06); --tick-read: #0ea5e9;
  }
}
.emo, .ep-grid button, .ep-tabs button, .m-text.emo-big {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", system-ui, sans-serif;
}

/* قائمة المحادثات */
.top-actions .ta-ic { width: 40px; height: 40px; padding: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.chat-row .rn-row { display: flex; align-items: baseline; gap: 8px; }
.chat-row .rn-row .rn { flex: 1; min-width: 0; }
.chat-row time { color: var(--faint); font-size: 12px; flex-shrink: 0; }
.chat-row.has-unread time { color: var(--green); font-weight: 700; }
.chat-row .rs-row { display: flex; align-items: center; gap: 8px; margin-top: 1px; }
.chat-row .rs { flex: 1; min-width: 0; }
.chat-row .rs-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chat-row.has-unread .rs-t { color: var(--text); }
.chat-row .typing { color: var(--green); font-weight: 600; }
.row .rs .tick svg { width: 16px; height: 16px; }
.ch-flags { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.ch-flags .cnt { min-width: 21px; height: 21px; border-radius: 11px; background: var(--green); color: #fff; font-size: 11.5px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; padding: 0 6px; }
.ch-flags .cnt.muted { background: var(--faint); }
.ch-flags .muted-ic { color: var(--faint); display: flex; }
.ch-flags .muted-ic svg { width: 15px; height: 15px; }
.av.av-grp { border-radius: 32%; }
.av.av-grp svg { width: 56%; height: 56%; }
.ch-found { margin-top: 4px; }
.tag { font-size: 11.5px; font-weight: 800; color: var(--accent); background: var(--accent-soft); padding: 3px 9px; border-radius: 999px; flex-shrink: 0; }

/* شاشة المحادثة */
.chat-scr {
  position: fixed; top: 0; bottom: 0; left: 0; right: 0; margin: 0 auto; max-width: 560px; z-index: 30;
  display: flex; flex-direction: column; background: var(--chat-bg); overflow: hidden;
}
@media (min-width: 700px) { .chat-scr { border-inline: 1px solid var(--line); } }
.ch-top {
  display: flex; align-items: center; gap: 2px; padding: calc(6px + var(--safe-t)) 6px 6px; background: var(--bg);
  border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.ch-top .ibtn { width: 40px; height: 40px; }
.ch-top .ibtn.back { color: var(--text); }
.ch-top .ibtn.back svg { width: 26px; height: 26px; }
.ch-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 12px; text-align: start; }
.ch-who:hover { background: var(--card); }
.ch-wt { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.ch-wt b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-wt small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-wt small.typing { color: var(--green); font-weight: 600; }

.ch-body { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.ch-msgs { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 6px 10px 10px; }
.ch-list { display: flex; flex-direction: column; min-height: 100%; }
.ch-more { text-align: center; color: var(--muted); font-size: 12.5px; padding: 6px; }
.ch-jump {
  position: absolute; bottom: 12px; inset-inline-end: 12px; width: 42px; height: 42px; border-radius: 50%; background: var(--card);
  color: var(--muted); box-shadow: 0 3px 12px rgba(0, 0, 0, .25); display: flex; align-items: center; justify-content: center; z-index: 2;
}
.ch-jump b { position: absolute; top: -6px; inset-inline-start: -4px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--green);
  color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.ch-left { flex-shrink: 0; text-align: center; padding: 14px 16px calc(14px + var(--safe-b)); color: var(--muted); background: var(--bg);
  border-top: 1px solid var(--line); font-size: 14px; }
.ch-drop { display: none; }
.chat-scr.drop .ch-drop {
  display: flex; position: absolute; inset: 8px; z-index: 6; border: 3px dashed var(--accent); border-radius: 18px; background: var(--accent-soft);
  align-items: center; justify-content: center; gap: 10px; font-weight: 800; font-size: 17px; color: var(--accent); pointer-events: none;
}

/* الفقاعات */
.m-day { align-self: center; background: var(--bub-them); color: var(--muted); font-size: 12px; font-weight: 700; padding: 4px 12px;
  border-radius: 8px; margin: 10px 0 4px; box-shadow: 0 1px 1px rgba(0, 0, 0, .1); }
.m-unread { align-self: stretch; text-align: center; background: var(--accent-soft); color: var(--green); font-size: 12.5px; font-weight: 700;
  padding: 5px; margin: 8px -10px 2px; }
.m-empty { margin: auto; align-self: center; color: var(--muted); background: var(--bub-them); padding: 10px 16px; border-radius: 12px;
  font-size: 13.5px; text-align: center; max-width: 300px; }
.msg { display: flex; flex-direction: column; align-items: flex-start; margin-top: 2px; }
.msg.me { align-items: flex-end; }
.msg.first { margin-top: 7px; }
.msg.sys { align-items: center; margin: 6px 0; }
.msg.sys span { background: var(--bub-them); color: var(--muted); font-size: 12.5px; padding: 5px 12px; border-radius: 10px; text-align: center;
  max-width: 330px; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); }
.bub {
  position: relative; max-width: min(84%, 470px); min-width: 64px; padding: 6px 9px 6px; border-radius: 12px; background: var(--bub-them);
  color: var(--text); box-shadow: 0 1px 1.5px rgba(0, 0, 0, .14); font-size: 15px; line-height: 1.42; user-select: text;
  -webkit-touch-callout: none; transition: box-shadow .3s;
}
.msg.me .bub { background: var(--bub-me); color: var(--bub-me-text); }
@media (hover: none) { .bub { -webkit-user-select: none; user-select: none; } }
.msg.them.first .bub { border-start-start-radius: 3px; }
.msg.me.first .bub { border-start-end-radius: 3px; }
.msg.hl .bub { box-shadow: 0 0 0 3px var(--amber); }
.m-name { font-size: 12.5px; font-weight: 800; margin-bottom: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-text { white-space: pre-wrap; overflow-wrap: anywhere; display: flow-root; }
.m-text[dir="ltr"] { text-align: left; }
.m-text a { color: var(--tick-read); text-decoration: underline; }
.m-text.emo-big { font-size: 40px; line-height: 1.2; }
.bub.del .m-text { font-style: italic; color: var(--bub-meta); }
.m-meta { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--bub-meta); white-space: nowrap; line-height: 1;
  font-style: normal; direction: ltr; font-family: system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", "Geeza Pro", sans-serif; }
.m-meta.in-text { float: left; margin: 9px 0 -4px 10px; position: relative; top: 3px; }
.m-meta.in-text.ltr { float: right; margin: 9px -2px -4px 10px; }
.m-meta.in-text.rtl { float: left; margin: 9px 10px -4px -2px; }
.bub > .m-meta { display: flex; justify-content: flex-end; margin-top: 2px; }
.bub.media-only { padding: 3px; }
.bub.media-only > .m-meta { position: absolute; bottom: 8px; inset-inline-end: 10px; color: #fff; background: rgba(0, 0, 0, .42);
  padding: 3px 7px; border-radius: 9px; margin: 0; }
.bub.media-only .tick.read { color: #7dd3fc; }
.tick { display: inline-flex; }
.tick svg { width: 16px; height: 16px; }
.tick.read { color: var(--tick-read); }
.tick.fail { color: var(--red); }
.m-fw { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--bub-meta); margin-bottom: 2px; }
.m-fw svg { width: 14px; height: 14px; }
.m-reply { display: flex; align-items: center; gap: 8px; background: var(--bub-soft); border-inline-start: 4px solid var(--green);
  border-radius: 8px; padding: 5px 8px; margin: 2px -3px 5px; cursor: pointer; min-width: 160px; }
.m-reply .mr-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.m-reply .mr-t b { font-size: 12.5px; }
.m-reply .mr-t span { font-size: 13px; color: var(--bub-meta); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-reply img { width: 42px; height: 42px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.m-img { width: min(290px, 66vw); max-height: 380px; border-radius: 9px; overflow: hidden; background: var(--bub-soft); margin: 0 0 4px; cursor: zoom-in; }
.bub.media-only .m-img, .bub.media-only .m-video { margin: 0; }
.m-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-video { position: relative; width: min(290px, 66vw); aspect-ratio: 16 / 10; background: #000; border-radius: 9px; overflow: hidden;
  display: flex; align-items: center; justify-content: center; cursor: pointer; margin-bottom: 4px; }
.m-video img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.m-video .play { position: relative; width: 54px; height: 54px; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff;
  display: flex; align-items: center; justify-content: center; }
.m-video .play svg { width: 22px; height: 22px; margin-inline-end: -3px; }
.m-video small { position: absolute; bottom: 8px; inset-inline-start: 10px; color: #fff; font-size: 11.5px; background: rgba(0, 0, 0, .45);
  padding: 2px 7px; border-radius: 7px; direction: ltr; }
.m-voice { display: flex; align-items: center; gap: 10px; width: min(250px, 62vw); padding: 3px 0 1px; }
.vplay { width: 40px; height: 40px; border-radius: 50%; background: var(--green); color: #fff; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; }
.vplay svg { width: 17px; height: 17px; }
.vbar { flex: 1; height: 6px; border-radius: 3px; background: rgba(127, 127, 127, .35); position: relative; cursor: pointer; overflow: hidden; }
.vbar::before { content: ""; position: absolute; inset: -10px 0; }
.vbar i { position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 0; background: var(--green); border-radius: 3px; }
.vtime { font-size: 12px; color: var(--bub-meta); font-variant-numeric: tabular-nums; min-width: 34px; direction: ltr; }
.m-file { display: flex; align-items: center; gap: 10px; background: var(--bub-soft); border-radius: 10px; padding: 8px 10px; margin: 1px -3px 4px;
  cursor: pointer; width: min(290px, 68vw); }
.fi-ic { width: 40px; height: 48px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 900;
  color: #fff; background: #64748b; flex-shrink: 0; letter-spacing: .3px; direction: ltr; }
.fi-ic.pdf { background: #dc2626; } .fi-ic.doc { background: #2563eb; } .fi-ic.xls { background: #16a34a; } .fi-ic.ppt { background: #ea580c; }
.fi-ic.zip { background: #a16207; } .fi-ic.img { background: #9333ea; } .fi-ic.media { background: #0891b2; }
.fi-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fi-t b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fi-t small { color: var(--bub-meta); font-size: 12px; }
.fi-dl { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: inherit; flex-shrink: 0;
  border: 1.5px solid currentColor; opacity: .75; }
.fi-dl svg { width: 18px; height: 18px; }
.m-upbox { display: flex; align-items: center; gap: 8px; margin: 4px 0 2px; min-width: 190px; }
.m-up { flex: 1; height: 4px; border-radius: 2px; background: rgba(127, 127, 127, .3); overflow: hidden; }
.m-up i { display: block; height: 100%; width: 0; background: var(--green); transition: width .2s; }
.m-uptxt { font-size: 11.5px; color: var(--bub-meta); white-space: nowrap; }
.m-cancel { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(127, 127, 127, .25); flex-shrink: 0; }
.m-cancel svg { width: 14px; height: 14px; }
.m-retry { font-size: 12px; color: var(--red); padding: 3px 6px; font-weight: 700; }

/* كتابة الرسالة */
.ch-composer { flex-shrink: 0; background: var(--bg); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + var(--safe-b)); }
.ch-composer:has(.ch-emoji:not([hidden])) { padding-bottom: 0; }
.chat-scr.kb .ch-composer { padding-bottom: 6px; }
.ch-reply { display: flex; align-items: center; gap: 6px; background: var(--card2); border-inline-start: 4px solid var(--green); border-radius: 10px;
  padding: 5px 6px 5px 10px; margin: 0 4px 6px; }
.ch-reply .cr-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ch-reply .cr-t b { font-size: 12.5px; }
.ch-reply .cr-t span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-reply .ibtn { width: 32px; height: 32px; color: var(--muted); }
.ch-row { display: flex; align-items: flex-end; gap: 2px; }
.ch-row .ibtn { color: var(--muted); width: 40px; height: 44px; border-radius: 12px; flex-shrink: 0; }
.ch-row .ibtn.on { color: var(--green); }
.ch-row .ibtn svg { width: 23px; height: 23px; }
.ch-row textarea {
  flex: 1; min-width: 0; resize: none; min-height: 44px; max-height: 140px; border-radius: 22px; padding: 10px 14px; background: var(--card2);
  border: 1px solid var(--line); color: var(--text); font-size: 16px; line-height: 1.4; outline: none; overflow-y: auto; margin: 0 2px;
}
.ch-row textarea:focus { border-color: var(--accent); }
.ch-row textarea::placeholder { color: var(--faint); }
.ch-send { width: 44px; height: 44px; border-radius: 50%; background: var(--green); color: #fff; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; margin-inline-start: 2px; }
.ch-send:active { background: var(--green-d); }
.ch-send svg { width: 21px; height: 21px; }
.ch-rec { display: flex; align-items: center; gap: 10px; min-height: 44px; padding-inline-start: 2px; }
.ch-rec b { font-variant-numeric: tabular-nums; font-size: 16px; min-width: 44px; }
.ch-rec .rec-hint { flex: 1; color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--red); animation: blink 1s ease-in-out infinite; flex-shrink: 0; }
.ch-emoji { height: min(290px, 42vh); display: flex; flex-direction: column; border-top: 1px solid var(--line); margin: 6px -6px 0; background: var(--bg); }
.ep-tabs { display: flex; overflow-x: auto; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--line); scrollbar-width: none; flex-shrink: 0; }
.ep-tabs::-webkit-scrollbar { display: none; }
.ep-tabs button { font-size: 20px; padding: 5px 8px; border-radius: 9px; opacity: .55; flex-shrink: 0; line-height: 1.2; }
.ep-tabs button.on { opacity: 1; background: var(--card2); }
.ep-grid { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  padding: 2px 6px calc(8px + var(--safe-b)); align-content: start; overscroll-behavior: contain; }
.ep-grid button { font-size: 28px; height: 46px; border-radius: 10px; line-height: 1; }
.ep-grid button:active, .ep-grid button:hover { background: var(--card2); }
.ep-grid .ep-h { grid-column: 1 / -1; font-size: 12px; color: var(--muted); padding: 8px 4px 4px; font-weight: 700; }

/* عارض الصور والفيديو */
.viewer { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; color: #fff; }
.vw-top { display: flex; align-items: center; gap: 10px; padding: calc(8px + var(--safe-t)) 10px 8px; flex-shrink: 0; }
.vw-title { flex: 1; min-width: 0; font-size: 14px; color: rgba(255, 255, 255, .85); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer a.icon-btn { text-decoration: none; }
.vw-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 0 var(--safe-b); }
.vw-body img, .vw-body video { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }

/* قوائم الإجراءات والاختيار */
.act-sheet { padding-top: 12px; }
.act-list { display: flex; flex-direction: column; margin-bottom: 10px; }
.act-title { color: var(--muted); font-size: 13px; text-align: center; padding: 2px 12px 10px; font-weight: 700; }
.act { display: flex; align-items: center; gap: 14px; padding: 13px 12px; border-radius: 12px; font-size: 15.5px; font-weight: 600; text-align: start; width: 100%; }
.act:hover, .act:active { background: var(--card); }
.act svg { width: 21px; height: 21px; color: var(--muted); }
.act.danger, .act.danger svg { color: var(--red); }
.info-h { margin: 0 0 12px; font-size: 18px; padding-inline-end: 44px; }
.info-actions { display: flex; justify-content: center; margin-top: 16px; }
.sheet.pick { display: flex; flex-direction: column; height: 88vh; }
.pick-body { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.pick-title, .pick-search { margin-bottom: 8px; flex-shrink: 0; }
.pick-chips { padding: 0 0 8px; flex-wrap: wrap; flex-shrink: 0; }
.pick-list { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -18px; }
.pick-list .row { min-height: 58px; }
.pick-row.on { background: var(--accent-soft); }
.pick-row .ck { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--faint); display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0; }
.pick-row .ck svg { width: 15px; height: 15px; stroke-width: 3; }
.pick-row.on .ck { background: var(--green); border-color: var(--green); }
.pick-new { border-radius: 14px; border: 1px solid var(--line); margin-bottom: 10px; background: var(--card); }
.av.grp-new { background: var(--green); }
.av.grp-new svg { width: 22px; height: 22px; }
.pick-foot { flex-shrink: 0; padding-top: 10px; }
/* ───── مجموعة جديدة: الاسم ← الطريقة ← (النيابات | الأعضاء) ───── */
.pick-head { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.pick-head .info-h { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-head.has-back .info-h { margin-bottom: 8px; }
.pick-back { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text); flex-shrink: 0; margin: -4px -6px 8px 0; }
.pick-back:hover { background: var(--card2); }
.pick-back svg { width: 22px; height: 22px; }
.pick-hint { color: var(--muted); font-size: 13.5px; margin: -4px 0 12px; line-height: 1.6; flex-shrink: 0; }
.pick-hint.small { font-size: 12.5px; }
.pick-grow { flex: 1; }
.pick-method { border-radius: 16px; border: 1px solid var(--line); margin-bottom: 10px; background: var(--card); width: 100%; text-align: start; min-height: 76px; }
.pick-method:disabled { opacity: .55; cursor: not-allowed; }
.pick-method .rs.pm-sub { white-space: normal; line-height: 1.5; }
.av.pm-ic { background: var(--accent-soft); color: var(--accent); }
.av.pm-ic svg { width: 22px; height: 22px; }
.pm-go { color: var(--faint); display: flex; flex-shrink: 0; }
.pm-go svg { width: 20px; height: 20px; }
.org-row { padding: 0; align-items: stretch; gap: 0; }
.org-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 9px 16px; cursor: pointer; }
.org-row .org-in { flex-shrink: 0; display: flex; align-items: center; gap: 2px; padding: 0 14px 0 16px; color: var(--muted); font-size: 12.5px; font-weight: 800;
  border-inline-start: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.org-row .org-in:hover { color: var(--accent); background: var(--card2); }
.org-row .org-in svg { width: 20px; height: 20px; }
.org-row.covered .ck { opacity: .55; }
.org-crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; flex-shrink: 0; margin: -2px 0 6px; font-size: 13px; }
.org-crumbs[hidden] { display: none; }
.crumb { color: var(--accent); font-weight: 700; padding: 3px 6px; border-radius: 8px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb:hover { background: var(--accent-soft); }
.crumb.on { color: var(--text); }
.crumb-sep { color: var(--faint); }
.pick-warn { color: var(--red); font-size: 13px; font-weight: 700; text-align: center; margin-bottom: 8px; }
.grp-units { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); border: 1px solid rgba(16, 185, 129, .3);
  border-radius: 14px; padding: 10px 12px; margin: 14px 0 0; font-size: 13px; line-height: 1.6; }
.grp-units .gu-ic { color: var(--accent); flex-shrink: 0; display: flex; margin-top: 2px; }
.grp-units .gu-ic svg { width: 20px; height: 20px; }
.grp-units b { display: block; font-size: 13.5px; }
.grp-units span { color: var(--muted); }
.gi-search { margin: 4px 0 6px; }
.gi-more { width: 100%; margin: 10px 0 0; }
.ct-more { text-align: center; color: var(--muted); padding: 16px; font-size: 13px; }
.tgl { display: flex; align-items: center; gap: 10px; font-size: 14.5px; cursor: pointer; font-weight: 600; }
.tgl input { width: 22px; height: 22px; padding: 0; margin: 0; flex-shrink: 0; accent-color: var(--green); }
@media (max-width: 380px) {
  .tabbar button { font-size: 10px; }
  .tabbar button em { max-width: 64px; overflow: hidden; text-overflow: ellipsis; }
}
