/* RP-BOX — هوية أحادية اللون (أسود/أبيض) مع إشارات: أحمر للإرسال، أخضر للاتصال */
:root {
  --bg: #f4f4f2;
  --card: #ffffff;
  --text: #111111;
  --muted: #6b6b6b;
  --line: #e4e4e0;
  --ink: #111111;
  --ink-text: #ffffff;
  --live: #e5372b;
  --live-soft: #fde8e6;
  --ok: #1f9d55;
  --ok-soft: #e3f5ea;
  --radius: 16px;
  --logo-filter: none;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0c0c;
    --card: #171717;
    --text: #f1f1f1;
    --muted: #9a9a9a;
    --line: #2a2a2a;
    --ink: #f1f1f1;
    --ink-text: #0c0c0c;
    --live-soft: #3a1512;
    --ok-soft: #10301e;
    --logo-filter: invert(1);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; }
.center { text-align: center; }
img[src$="logo.png"] { filter: var(--logo-filter); }

/* أزرار وحقول */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1.5px solid transparent; border-radius: 12px;
  padding: 11px 20px; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; background: none; color: inherit; white-space: nowrap;
}
.btn.primary { background: var(--ink); color: var(--ink-text); }
.btn.ghost { border-color: var(--line); background: var(--card); }
.btn.danger { color: var(--live); border-color: var(--line); background: var(--card); }
.btn.sm { padding: 6px 12px; font-size: .85rem; border-radius: 10px; }
.btn.lg { padding: 14px 28px; font-size: 1.05rem; }
.btn.block { display: flex; width: 100%; }
.btn:active { transform: scale(.98); }

input, select {
  width: 100%; font: inherit; color: var(--text);
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 11px 14px; outline: none;
}
input:focus, select:focus { border-color: var(--ink); }
input[dir="ltr"] { text-align: left; }
input[dir="ltr"]::placeholder { text-align: left; }

.form { display: grid; gap: 14px; margin-top: 18px; }
.form label { display: grid; gap: 6px; font-weight: 500; font-size: .92rem; }
.check { display: flex !important; align-items: center; gap: 8px; font-weight: 400 !important; }
.check input { width: auto; }

.alert { background: var(--live-soft); border-radius: 12px; padding: 12px 14px; margin: 12px 0; font-size: .92rem; }
.alert.ok { background: var(--ok-soft); }
.alert .btn { margin-top: 10px; }
.tag { display: inline-block; background: var(--ink); color: var(--ink-text); border-radius: 999px; padding: 2px 10px; font-size: .75rem; }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: .5px; white-space: nowrap; }
.brand img { width: 40px; height: 40px; }
.brand span { direction: ltr; }

/* صفحات الدخول */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 28px 22px; }
.auth-card .brand { margin-bottom: 18px; }
.switch { text-align: center; margin: 14px 0 0; font-size: .92rem; }

/* صفحة الهبوط */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; max-width: 1080px; margin: 0 auto; }
.topbar nav { display: flex; gap: 8px; }
.hero { text-align: center; padding: 28px 16px 48px; max-width: 760px; margin: 0 auto; }
.hero-mark { width: 150px; height: 150px; margin-bottom: 18px; }
.hero h1 { font-size: clamp(1.8rem, 6vw, 3rem); font-weight: 700; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 620px; margin: 0 auto 26px; }
.hero-cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; max-width: 1080px; margin: 0 auto; padding: 0 16px 48px; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.step b { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: var(--ink-text); margin-bottom: 10px; }
.step p { color: var(--muted); margin: 0; }
.uses, .plans { max-width: 1080px; margin: 0 auto; padding: 0 16px 48px; }
.uses h2, .plans h2 { text-align: center; font-size: 1.6rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 22px; }
.chips span { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; font-size: .9rem; }
.features { list-style: none; padding: 0; margin: 0 auto; max-width: 680px; display: grid; gap: 10px; }
.features li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.plan { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; }
.plan.featured, .plan.current { border-color: var(--ink); }
.plan .price { font-size: 1.9rem; font-weight: 700; margin: 4px 0; }
.plan .price small { font-size: .85rem; font-weight: 400; color: var(--muted); }
.plan ul { padding: 0 18px 0 0; margin: 8px 0 18px; flex: 1; }
.plan .tag { align-self: flex-start; }
.foot { text-align: center; color: var(--muted); padding: 24px 16px 40px; font-size: .9rem; }

/* التطبيق */
body.app { min-height: 100dvh; display: flex; flex-direction: column; }
.appbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--card); border-bottom: 1px solid var(--line);
}
.appbar-title { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.appbar-title #title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-title #subtitle { line-height: 1.2; }
.appbar-logo { width: 34px; height: 34px; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 0; background: none; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--bg); }
.view { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 640px; margin: 0 auto; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card h3 { font-size: 1rem; }

.rooms, .members, .account { padding: 14px 16px 32px; }
.room-card { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; text-decoration: none; }
.room-avatar { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--ink); color: var(--ink-text); font-weight: 700; font-size: 1.2rem; }
.room-info { flex: 1; min-width: 0; display: grid; }
.room-info b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-meta { display: grid; justify-items: end; gap: 2px; }
.room-meta .dot-online { display: inline-block; }
.room-card.pending { border-style: dashed; }
.room-card.pending .room-avatar { background: var(--line); color: var(--muted); }
.admin-link { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; text-decoration: none; background: var(--ink); color: var(--ink-text); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 12px; font-size: .9rem; }
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--live); color: #fff; font-size: .78rem; font-weight: 700; }
.new-room { display: flex; gap: 8px; margin: 16px 0 8px; }
.new-room .btn { flex: none; }
.empty { text-align: center; padding: 30px 10px 10px; }
.empty img { width: 90px; height: 90px; opacity: .9; margin-bottom: 10px; }

.dot-online, .dot-off { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot-online { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot-off { background: var(--line); }

.member { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.member:last-child { border-bottom: 0; }
.member-info { flex: 1; min-width: 140px; display: grid; }
.add-member { display: grid; gap: 10px; }
.inline { display: flex; gap: 8px; margin-bottom: 10px; }
.inline .btn { flex: none; }
.account .btn.block { margin-top: 10px; }
.plan-grid.compact { margin-bottom: 12px; }

/* شاشة الغرفة */
.room { flex: 1; display: flex; flex-direction: column; min-height: 0; height: calc(100dvh - 62px); }
/* أعلى الغرفة: عناصر ثابتة لا تختفي ولا تقفز (بعض المتصفحات تُخفي العناصر المتحركة أو المتبدلة) */
.room-top { flex: none; display: grid; gap: 8px; padding: 10px 16px 0; }
.talking-now {
  min-height: 44px; padding: 10px 14px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line); color: var(--muted);
  display: flex; align-items: center; gap: 10px; font-size: .92rem;
}
.talking-now.active { background: var(--ok-soft); border-color: transparent; color: var(--text); font-weight: 600; }
.dot-idle { width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex: none; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex: none; animation: pulse 1s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(31, 157, 85, .6); } 100% { box-shadow: 0 0 0 12px rgba(31, 157, 85, 0); } }
.audio-gate {
  width: 100%; min-height: 48px; padding: 12px; border: 0; border-radius: 12px;
  background: var(--live); color: #fff; font: inherit; font-weight: 700; cursor: pointer;
  opacity: 1; visibility: visible; transform: none;
}
.clips { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.hint { padding: 8px 0 4px; }
.clip {
  display: grid; grid-template-columns: auto auto 1fr auto auto; align-items: center; gap: 10px;
  width: 100%; max-width: 88%; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit; text-align: right; cursor: pointer;
}
.clip.mine { align-self: flex-end; background: var(--bg); }
.clip.playing { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.clip-play { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--ink-text); font-size: .7rem; }
.clip.playing .clip-play { background: var(--ok); color: #fff; }
.clip-who { font-weight: 600; font-size: .9rem; white-space: nowrap; }
.clip-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.clip-bar i { display: block; height: 100%; background: var(--muted); border-radius: 3px; }
.clip-dur, .clip-time { font-size: .75rem; color: var(--muted); white-space: nowrap; }

.ptt-wrap {
  flex: none; display: grid; justify-items: center; gap: 6px;
  padding: 18px 16px; padding-bottom: max(22px, env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line);
}
.ptt {
  width: 132px; height: 132px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--ink); color: var(--ink-text);
  display: grid; place-items: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18), inset 0 -6px 0 rgba(0, 0, 0, .15);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: transform .12s, background .12s;
}
.ptt:active, .ptt.talking { transform: scale(.94); }
.ptt.talking { background: var(--live); color: #fff; box-shadow: 0 0 0 10px var(--live-soft), 0 0 0 22px rgba(229, 55, 43, .08); animation: talk 1.2s infinite; }
.ptt.sending { opacity: .6; }
@keyframes talk { 50% { box-shadow: 0 0 0 14px var(--live-soft), 0 0 0 30px rgba(229, 55, 43, .05); } }
.ptt-label { font-weight: 600; }
.ptt-count { min-height: 1.2em; direction: ltr; }
.listen-only { padding: 18px; color: var(--muted); font-weight: 600; }
@media (hover: none) { .desktop-only { display: none; } }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20;
  background: var(--ink); color: var(--ink-text); border-radius: 12px; padding: 12px 18px;
  max-width: calc(100% - 32px); font-size: .92rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}
.toast[hidden] { display: none; }

/* الإدارة */
.admin-wrap { max-width: 900px; margin: 0 auto; padding: 8px 16px 40px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 24px; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; color: var(--muted); }
.stats b { font-size: 1.6rem; color: var(--text); }
.row-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.inline-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.inline-form select { width: auto; padding: 6px 10px; }
.inline-form input { width: 64px; padding: 6px 8px; }
.search { display: flex; gap: 8px; margin-bottom: 12px; }
.admin-wrap h2 { margin-top: 28px; }
.stats small { font-size: .9rem; color: var(--muted); font-weight: 400; }
.tag.ok { background: var(--ok); color: #fff; }
a.room-row { text-decoration: none; }
a.room-row:hover { border-color: var(--ink); }
.room-row .dot-online { display: inline-block; vertical-align: middle; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { color: var(--muted); font-weight: 500; font-size: .8rem; }
.table tr:last-child td { border-bottom: 0; }
.table .dot-online, .table .dot-off { display: inline-block; }
.activity { padding: 8px 0; border-bottom: 1px solid var(--line); }
.search .btn { flex: none; }
.nowrap { white-space: nowrap; }
.version { text-align: center; color: var(--muted); font-size: .72rem; letter-spacing: .3px; padding: 18px 16px 22px; opacity: .8; }

/* من يفضّل تقليل الحركة: نوقف النبض والوميض ونُبقي الألوان فقط */
@media (prefers-reduced-motion: reduce) {
  .pulse, .ptt.talking { animation: none; }
}

/* الإدارة: تبويبات، بلاغات، إجراءات المستخدمين */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 18px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.tabs a { text-decoration: none; padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: .92rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.tabs a.on { background: var(--ink); color: var(--ink-text); }
.on-link { font-weight: 700; text-decoration: none; }
.tag.danger { background: var(--live); color: #fff; }
.report { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 10px; display: grid; gap: 8px; }
.report.open { border-color: var(--live); }
.report-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.report-details { background: var(--bg); border-radius: 10px; padding: 8px 10px; margin-top: 4px; }
.report audio { width: 100%; max-width: 420px; }
.report-actions { display: grid; gap: 8px; }
.user-row.banned { border-color: var(--live); }
.actions { position: relative; }
.actions > summary { list-style: none; cursor: pointer; }
.actions > summary::-webkit-details-marker { display: none; }
.actions[open] { flex-basis: 100%; }
.actions-body { display: grid; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.actions-body input { width: auto; flex: 1; min-width: 140px; padding: 6px 10px; }
.add-user summary { cursor: pointer; }
.add-user .form { margin-top: 12px; }
.inline-form.card { padding: 12px; }
.inline-form input[name="phone"], .inline-form input[name="label"] { width: auto; flex: 1; min-width: 130px; padding: 6px 10px; }
.table .inline-form { flex-wrap: nowrap; }

/* البلاغات في التطبيق */
.clip { position: relative; }
.clip-flag { border: 0; background: none; color: var(--muted); font-size: .95rem; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.clip-flag:hover { color: var(--live); background: var(--live-soft); }
.clip { grid-template-columns: auto auto 1fr auto auto auto; }
.member-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn.icon { padding: 6px 10px; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 520px; background: var(--card); border-radius: 22px 22px 0 0; padding: 22px 18px; padding-bottom: max(22px, env(safe-area-inset-bottom)); display: grid; gap: 12px; }
.reasons { display: grid; gap: 6px; }
.reason { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; }
.reason:has(input:checked) { border-color: var(--ink); }
.reason input { width: auto; }
.sheet textarea { width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; resize: vertical; }
.sheet-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

/* صفحات الخصوصية والشروط والدعم */
.doc { max-width: 760px; margin: 0 auto; padding: 8px 16px 40px; line-height: 1.9; }
.doc h2 { margin-top: 26px; font-size: 1.2rem; }
.doc ul { padding-right: 20px; }
.doc details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.doc summary { cursor: pointer; }
.doc .en { text-align: left; color: var(--muted); font-size: .92rem; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 30px 0; }
.version a { color: inherit; }
.check.agree { font-size: .88rem; line-height: 1.7; align-items: flex-start !important; }
.check.agree input { margin-top: 5px; }
