/* ═══════════ UNSMM — نظام التصميم ═══════════
   الخلفية: كحلي فحمي عميق | الأكسنت: نيلي كهربائي
   الحالات الحية: تيل | التنبيه: كهرماني            */

:root {
  --bg:       #0A0E17;
  --surface:  #111726;
  --surface2: #161E30;
  --border:   #232B40;
  --text:     #E8ECF4;
  --muted:    #8A93A8;
  --accent:   #6E5BD6;   /* تعبئة فقط (أزرار/شرائح). يفشل كنص على الداكن (3.8:1) */
  --accent-2: #9B7CFF;
  --accent-ink: #9B7CFF; /* نص/روابط الأكسنت على الداكن — 6.2:1، يمرّ WCAG AA */
  --live:     #2DD4BF;
  --warn:     #F59E0B;
  --danger:   #F87171;
  --radius:   14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* أرقام جدولية للبيانات — تمنع القفز البصري في الأعمدة والمبالغ والعدّادات (قاعدة number-tabular) */
.stat b, .price, .th-price, .quota-label, .table td, .badge, .chip, code, .snippet { font-variant-numeric: tabular-nums; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Sans Arabic', sans-serif;
  font-size: 15px;
  line-height: 1.7;
  min-height: 100vh;
  /* حاجز أخير ضد أي شريط تمرير أفقي من عنصر زائد العرض (الجداول لها overflow خاص بها) */
  overflow-x: hidden;
}
a { color: var(--accent-ink); text-decoration: none; }
h1, h2, h3 { line-height: 1.35; margin: 0 0 10px; }
code { background: var(--surface2); padding: 2px 7px; border-radius: 6px; font-size: 13px; direction: ltr; display: inline-block; }
i.fi { vertical-align: middle; line-height: 1; }

/* ═══════════ الأزرار ═══════════ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; transition: .18s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 4px 18px rgba(110,91,214,.28);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(110,91,214,.4); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn-lg { padding: 13px 28px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }
.btn-mini { padding: 5px 12px; font-size: 12.5px; background: var(--surface2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; }
.btn-mini:hover { border-color: var(--accent); }

/* ═══════════ الرأس العام ═══════════ */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px clamp(16px, 5vw, 64px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: rgba(10,14,23,.85); backdrop-filter: blur(12px); z-index: 50;
}
.topbar nav { display: flex; gap: 10px; }
.brand { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: .5px; }
.brand span { color: var(--accent-ink); }

/* ═══════════ البطل ═══════════ */
.hero {
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center;
  padding: clamp(48px, 8vw, 96px) clamp(16px, 5vw, 64px);
  max-width: 1200px; margin: 0 auto;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--live); background: rgba(45,212,191,.08);
  border: 1px solid rgba(45,212,191,.25); padding: 5px 14px; border-radius: 99px; margin-bottom: 20px;
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(45,212,191,.5); } 50% { box-shadow: 0 0 0 7px rgba(45,212,191,0); } }
.hero h1 { font-size: clamp(30px, 4.4vw, 50px); font-weight: 700; }
.hero h1 em { font-style: normal; color: var(--accent-ink); }
.hero p { color: var(--muted); font-size: 16.5px; max-width: 52ch; }
.hero-actions { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }

/* ── العنصر المميز: محاكاة التذكرة ── */
.ticket-demo {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.45);
}
.ticket-head {
  display: flex; align-items: center; gap: 7px;
  padding: 12px 16px; background: var(--surface2); border-bottom: 1px solid var(--border);
}
.ticket-head .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.ticket-head .dot:first-child { background: var(--danger); }
.ticket-head .dot:nth-child(2) { background: var(--warn); }
.ticket-head .dot:nth-child(3) { background: var(--live); }
.ticket-title { margin-inline-start: 8px; font-size: 13px; color: var(--muted); }
.ticket-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.msg { padding: 12px 16px; border-radius: 12px; font-size: 13.5px; max-width: 92%; }
.msg .who { font-size: 11.5px; font-weight: 700; margin-bottom: 5px; opacity: .8; }
.msg.client { background: var(--surface2); border: 1px solid var(--border); align-self: flex-start; }
.msg.bot {
  background: linear-gradient(160deg, rgba(110,91,214,.14), rgba(155,124,255,.07));
  border: 1px solid rgba(110,91,214,.35); align-self: flex-end;
}
.msg.bot .who { color: var(--accent-ink); }
.reply-meta { font-size: 12px; color: var(--live); align-self: flex-end; display: flex; gap: 6px; align-items: center; }
.anim-1 { animation: rise .6s .2s both; }
.anim-2 { animation: rise .6s 1.1s both; }
.anim-3 { animation: rise .6s 1.9s both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .anim-1, .anim-2, .anim-3, .pulse { animation: none !important; } }

/* ═══════════ المزايا والخطوات والباقات ═══════════ */
.features, .how, .plans { max-width: 1200px; margin: 0 auto; padding: 48px clamp(16px, 5vw, 64px); }
.features h2, .how h2, .plans h2 { font-size: 28px; text-align: center; margin-bottom: 34px; }
.feat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.feat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; transition: .2s; }
.feat:hover { border-color: rgba(110,91,214,.5); transform: translateY(-3px); }
.feat i { font-size: 26px; color: var(--accent); }
.feat h3 { font-size: 17px; margin-top: 12px; }
.feat p { color: var(--muted); font-size: 14px; margin: 0; }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.step { text-align: center; padding: 26px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.step .n {
  display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); font-size: 20px; font-weight: 700; margin-bottom: 12px;
}
.step p { color: var(--muted); font-size: 14px; margin: 0; }

.plans-sub { text-align: center; color: var(--muted); margin-top: -22px; margin-bottom: 32px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; max-width: 1000px; margin: 0 auto; }
.plan { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 24px; }
.plan.featured { border-color: var(--accent); box-shadow: 0 12px 44px rgba(110,91,214,.18); }
.plan .tag {
  position: absolute; top: -13px; right: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-size: 12px; font-weight: 700; padding: 4px 14px; border-radius: 99px;
}
.plan h3 { font-size: 18px; }
.price { font-size: 36px; font-weight: 700; margin: 8px 0 16px; }
.price span { font-size: 14px; color: var(--muted); font-weight: 400; }
.plan ul { list-style: none; padding: 0; margin: 0 0 20px; }
.plan li { display: flex; gap: 9px; align-items: center; padding: 6px 0; font-size: 14px; color: var(--muted); }
.plan li i { color: var(--live); font-size: 14px; }

.footer { text-align: center; padding: 32px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); margin-top: 40px; }

/* ═══════════ صفحات المصادقة ═══════════ */
.auth-wrap { display: grid; place-items: center; padding: 60px 16px; min-height: 62vh; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 34px; width: min(420px, 100%); }
.auth-card h2 { display: flex; gap: 10px; align-items: center; margin-bottom: 22px; }
.auth-alt { text-align: center; color: var(--muted); font-size: 13.5px; margin-top: 18px; }

/* ═══════════ النماذج ═══════════ */
label { display: block; font-size: 13.5px; font-weight: 600; margin: 16px 0 6px; }
input, select {
  width: 100%; padding: 11px 14px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font: inherit; transition: border-color .15s;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 5px 0 0; }
.form-actions { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 6px; align-items: center; }
.inline-form select { width: auto; padding: 5px 10px; font-size: 12.5px; }

/* المفاتيح التبديلية */
.switch-row { display: flex; gap: 14px; align-items: flex-start; margin-top: 22px; padding: 16px; background: var(--surface2); border-radius: 12px; }
.switch-row b { font-size: 14px; }
.switch-row .hint { margin-top: 2px; }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; margin-top: 2px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; z-index: 2; margin: 0; }
.slider { position: absolute; inset: 0; background: var(--border); border-radius: 99px; transition: .2s; }
.slider::before { content: ''; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: #fff; top: 3px; inset-inline-start: 3px; transition: .2s; }
.switch input:checked + .slider { background: var(--accent); }
/* الموضع النهائي بخاصية منطقية لا بـ translateX: الأخيرة تُزيح يسارًا فيزيائيًا في
   الاتجاهين، فكانت صحيحة في العربية (RTL) ومعكوسة في الإنجليزية (LTR).
   23px = عرض المفتاح 46 − قطر الزر 20 − هامش البداية 3. */
.switch input:checked + .slider::before { inset-inline-start: 23px; }

/* ═══════════ تخطيط لوحة التحكم ═══════════ */
body.app { display: flex; }
.sidebar {
  width: 248px; flex-shrink: 0; min-height: 100vh;
  background: var(--surface); border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 22px 16px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { font-size: 20px; padding: 0 10px 20px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.side-nav a {
  display: flex; gap: 11px; align-items: center;
  padding: 11px 14px; border-radius: 10px; color: var(--muted); font-weight: 500; transition: .15s;
}
.side-nav a:hover { color: var(--text); background: var(--surface2); }
.side-nav a.active { color: #fff; background: linear-gradient(135deg, rgba(110,91,214,.22), rgba(155,124,255,.12)); border: 1px solid rgba(110,91,214,.35); }
.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.sub-chip { display: flex; gap: 8px; align-items: center; font-size: 13px; padding: 9px 13px; border-radius: 10px; }
.sub-chip.ok { color: var(--live); background: rgba(45,212,191,.08); border: 1px solid rgba(45,212,191,.25); }
.sub-chip.warn { color: var(--warn); background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.3); }
.logout { color: var(--muted); font-size: 13px; display: flex; gap: 8px; align-items: center; padding: 8px 10px; width: 100%; }
.logout:hover { color: var(--danger); }

.main { flex: 1; padding: 32px clamp(16px, 3.5vw, 44px); max-width: 1100px; }
.menu-toggle { display: none; background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 9px 13px; margin-bottom: 16px; cursor: pointer; font-size: 16px; }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; margin: 0; }

/* ═══════════ البطاقات والإحصائيات ═══════════ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; }
.card-title { font-weight: 700; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; }
.card-title .link { font-size: 13px; font-weight: 500; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat i { font-size: 24px; color: var(--accent); }
.stat b { display: block; font-size: 24px; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.attn i { color: var(--warn); }
.stat.attn { border-color: rgba(245,158,11,.4); }

.quota-bar { height: 10px; background: var(--surface2); border-radius: 99px; overflow: hidden; margin: 6px 0 8px; }
.quota-bar .fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 99px; }
.quota-bar .fill.hot { background: linear-gradient(90deg, var(--warn), var(--danger)); }

/* ═══════════ الجداول والشارات ═══════════ */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: start; color: var(--muted); font-weight: 600; font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px; border-bottom: 1px solid rgba(35,43,64,.5); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }

.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 99px; }
.badge.ok { color: var(--live); background: rgba(45,212,191,.1); }
.badge.warn { color: var(--warn); background: rgba(245,158,11,.12); }
.badge.danger { color: var(--danger); background: rgba(248,113,113,.12); }
.badge.muted { color: var(--muted); background: var(--surface2); }
.chip { display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 8px; background: var(--surface2); border: 1px solid var(--border); direction: ltr; }

details summary { cursor: pointer; color: var(--accent-ink); font-size: 12.5px; }
.reply-pre { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-family: inherit; font-size: 13px; margin: 8px 0 0; max-width: 420px; }

.rules-list { padding: 0; margin: 0; list-style: none; }
.rules-list li { padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 14px; color: var(--muted); }
.rules-list li:last-child { border: 0; }
.rules-list b { color: var(--text); }

/* ═══════════ التنبيهات والرسائل ═══════════ */
.notice { display: flex; gap: 10px; align-items: center; padding: 14px 18px; border-radius: 12px; margin-bottom: 18px; font-size: 14px; }
.notice.info { background: rgba(110,91,214,.08); border: 1px solid rgba(110,91,214,.3); }
.notice.ok { background: rgba(45,212,191,.08); border: 1px solid rgba(45,212,191,.3); color: var(--live); }
.notice.warn { background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.35); color: var(--warn); }
.notice.danger { background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.35); color: var(--danger); }
.notice a { font-weight: 700; }

.flash { padding: 13px 18px; border-radius: 12px; margin: 14px auto; max-width: 640px; text-align: center; font-size: 14px; }
.flash-ok { background: rgba(45,212,191,.1); border: 1px solid rgba(45,212,191,.35); color: var(--live); }
.flash-error { background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.35); color: var(--danger); }

#test-result { margin-top: 12px; font-size: 14px; }
#test-result.ok { color: var(--live); }
#test-result.err { color: var(--danger); }

.filter-tabs { display: flex; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.filter-tabs a { padding: 6px 16px; border-radius: 8px; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.filter-tabs a.active { background: var(--surface2); color: var(--text); }

.pager { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pager a { padding: 5px 12px; border-radius: 8px; border: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.pager a.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pager a { min-width: 34px; text-align: center; }
.pager-gap { color: var(--muted); padding: 5px 4px; align-self: center; }

/* ═══════════ متجاوب ═══════════ */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 36px; }
  /* تجاوزات الشريط الجانبي أُزيلت — نظام الـ overlay الأحدث (≤768px) هو المسؤول.
     بين 769-900px يبقى الشريط المكتبي (248px) الطبيعي، وهو صالح تمامًا على التابلت.
     الإبقاء على النسخة القديمة هنا كان يخفي الشريط خارج الشاشة بينما يُخفى زر البرغر. */
}
@media (max-width: 560px) {
  .hero-actions .btn { width: 100%; justify-content: center; }
  .table { display: block; overflow-x: auto; white-space: nowrap; }
  .reply-pre { white-space: pre-wrap; max-width: 78vw; }
}

/* ═══════════ موديول الوكيل الذكي ═══════════ */
.side-sep { font-size: 11px; color: var(--muted); padding: 14px 14px 4px; letter-spacing: .5px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }
.hidden { display: none; }

.pro-box { margin-top: 22px; padding: 16px; border: 1px dashed var(--border); border-radius: 12px; }
.pro-box.locked { opacity: .75; }
.pro-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.pro-head b { display: flex; gap: 8px; align-items: center; }
.pro-head i { color: var(--warn); }

.snippet {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; font-family: monospace; font-size: 13px; overflow-x: auto;
  color: var(--live); user-select: all; white-space: nowrap;
}

.preview-chat {
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  min-height: 160px; max-height: 320px; overflow-y: auto;
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.pv-msg { max-width: 85%; padding: 10px 14px; border-radius: 12px; font-size: 13.5px; white-space: pre-wrap; }
.pv-msg.bot { background: var(--surface2); border: 1px solid var(--border); align-self: flex-start; }
.pv-msg.me { background: linear-gradient(135deg, var(--accent), var(--accent-2)); align-self: flex-end; }
.pv-msg .pv-score { display: block; margin-top: 6px; font-size: 11px; color: var(--muted); }

/* نافذة اقتراح ميزة */
.suggest-dlg { border: 1px solid var(--border); border-radius: 16px; background: var(--surface);
  color: var(--text); padding: 20px; width: min(480px, calc(100vw - 40px)); }
.suggest-dlg::backdrop { background: rgba(4, 8, 16, .6); backdrop-filter: blur(2px); }
button.tg-link { cursor: pointer; font: inherit; }

/* صفحة السجلات — شريط الفلاتر وشريط النسخ */
.lf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 12px; }
.lf-grid label { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; display: block; }
.lf-grid select, .lf-grid input {
  width: 100%; padding: 9px 10px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; font: inherit;
}
.logs-copybar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }

/* نقاط تحميل متحركة — بديل ⏳ الثابتة في حالات الانتظار */
.loading-dots { display: inline-flex; gap: 4px; margin-inline-start: 6px; vertical-align: middle; }
.loading-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .35;
  animation: dots-blink 1.2s infinite both;
}
.loading-dots span:nth-child(2) { animation-delay: .2s; }
.loading-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dots-blink {
  0%, 80%, 100% { opacity: .25; transform: scale(.75); }
  40%           { opacity: 1;   transform: scale(1); }
}
.preview-input { display: flex; gap: 8px; margin-top: 12px; }
.preview-input input { flex: 1; }

.cat-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.cat-chip { display: inline-flex; gap: 6px; align-items: center; }
.chip-x { background: none; border: 0; color: var(--danger); cursor: pointer; font-size: 15px; padding: 0; line-height: 1; }

.conv-view { display: flex; flex-direction: column; gap: 12px; }
.cv-msg { max-width: 80%; padding: 12px 15px; border-radius: 12px; font-size: 14px; }
.cv-msg.visitor { background: var(--surface2); border: 1px solid var(--border); align-self: flex-start; }
.cv-msg.bot { background: rgba(110,91,214,.1); border: 1px solid rgba(110,91,214,.3); align-self: flex-end; }
.cv-meta { font-size: 11.5px; color: var(--muted); margin-bottom: 5px; display: flex; gap: 8px; align-items: center; }

.bars { display: flex; gap: 6px; align-items: flex-end; height: 140px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 5px; }
.bar { width: 100%; max-width: 34px; background: linear-gradient(180deg, var(--accent), var(--accent-2)); border-radius: 6px 6px 0 0; min-height: 5px; }
.bar-col span { font-size: 10px; color: var(--muted); }
textarea { resize: vertical; }

/* ═══════════ خدمة الثيمات المخصصة — لمسة ذهبية بريميوم ═══════════ */
:root { --gold: #E8C574; --gold-2: #C9962E; }

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #1A1406; font-weight: 700;
  box-shadow: 0 4px 20px rgba(232,197,116,.25);
}
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 6px 28px rgba(232,197,116,.4); }
.badge.gold { color: var(--gold); background: rgba(232,197,116,.12); border: 1px solid rgba(232,197,116,.3); }
.step .n.gold { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #1A1406; }

.th-hero {
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center;
  padding: clamp(48px, 8vw, 90px) clamp(16px, 5vw, 64px);
  max-width: 1200px; margin: 0 auto;
}
.th-eyebrow {
  display: inline-block; font-size: 13px; color: var(--gold);
  background: rgba(232,197,116,.08); border: 1px solid rgba(232,197,116,.3);
  padding: 5px 14px; border-radius: 99px; margin-bottom: 20px;
}
.th-hero h1 { font-size: clamp(30px, 4.2vw, 48px); font-weight: 700; }
.th-hero h1 em { font-style: normal; color: var(--gold); }
.th-hero p { color: var(--muted); font-size: 16px; max-width: 54ch; }
.th-price-row { display: flex; gap: 22px; align-items: center; margin-top: 26px; flex-wrap: wrap; }
.th-price { font-size: 42px; font-weight: 700; color: var(--gold); line-height: 1.1; }
.th-price span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 400; }
.th-note { font-size: 13px !important; color: var(--muted); margin-top: 14px; }

.th-visual { position: relative; height: 340px; }
.th-frame {
  position: absolute; width: 78%; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 22px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 20px 50px rgba(0,0,0,.4);
}
.th-frame.f1 { top: 10px; inset-inline-start: 0; height: 200px; transform: rotate(-3deg); }
.th-frame.f2 { bottom: 10px; inset-inline-end: 0; height: 200px; transform: rotate(2.5deg); border-color: rgba(232,197,116,.45); }
.th-bar { height: 13px; border-radius: 7px; background: var(--surface2); }
.th-bar.gold { background: linear-gradient(90deg, var(--gold), var(--gold-2)); }
.th-dot-row { display: flex; gap: 8px; margin-top: auto; }
.th-dot-row span { width: 26px; height: 26px; border-radius: 8px; background: var(--surface2); }
.th-dot-row span.g { background: rgba(232,197,116,.35); }
.th-badge {
  position: absolute; top: 46%; inset-inline-start: 34%;
  background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #1A1406;
  font-size: 13px; font-weight: 700; padding: 9px 18px; border-radius: 99px;
  box-shadow: 0 10px 30px rgba(232,197,116,.35);
  display: flex; gap: 7px; align-items: center;
}

.th-includes, .th-how { max-width: 1200px; margin: 0 auto; padding: 48px clamp(16px, 5vw, 64px); }
.th-includes h2, .th-how h2 { font-size: 28px; text-align: center; margin-bottom: 12px; }
.th-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 16px; margin-top: 30px; }
.th-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column; gap: 6px; transition: .2s;
}
.th-item:hover { border-color: rgba(232,197,116,.45); transform: translateY(-2px); }
.th-item i { font-size: 22px; color: var(--gold); margin-bottom: 4px; }
.th-item b { font-size: 15px; }
.th-item span { color: var(--muted); font-size: 13.5px; line-height: 1.6; }

.nav-badge {
  display: inline-grid; place-items: center; min-width: 19px; height: 19px;
  padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700; margin-inline-start: auto;
}

@media (max-width: 900px) {
  .th-hero { grid-template-columns: 1fr; }
  .th-visual { height: 280px; }
}

/* ══════════════════════════════════════════════════════════════════════
   تحسينات UI/UX v5.1 — طبقة تجاوز (OVERRIDE LAYER)

   ⚠️ اقرأ هذا قبل تعديل أي نمط في هذا الملف:

   هذا القسم يُعيد تعريف أغلب المكونات المُعرَّفة أعلاه (.card, .stat, .table,
   .badge, .notice, .plan, input, label, .flash, .filter-tabs, .page-head ...).
   لأن CSS يطبّق القاعدة الأخيرة عند التعارض، فإن **القيم الفعّالة تأتي من هنا**،
   والقواعد الأعلى (L1-416) مُتجاوَزة جزئيًا.

   ➜ لتعديل مظهر أي مكوّن من القائمة أعلاه: عدّله **في هذا القسم**، لا في الأعلى.
     التعديل في الأعلى لن يظهر أثره (سيتجاوزه هذا القسم بصمت).

   ملاحظة صيانة: الأنظف مستقبلًا دمج الطبقتين في قاعدة واحدة لكل مكوّن، لكن الدمج
   ينقل ترتيب القواعد وقد يغيّر أيّها يفوز أمام محددات أخرى بنفس الأولوية — لذا
   يتطلب مراجعة بصرية للصفحات قبل تنفيذه. لا تدمج بدون فحص بصري.
   ══════════════════════════════════════════════════════════════════════ */

/* ── تحسين الأداء البصري ── */
* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* ── Focus States للـ Accessibility ── */
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ── تحسين الجداول على الموبايل ── */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: start; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 2px solid var(--border); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(110,91,214,.03); }

/* ── Grid System ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

/* ── Cards تحسين ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  transition: border-color .2s;
}
.card:hover { border-color: rgba(110,91,214,.2); }
.card-title {
  font-size: 16px; font-weight: 700; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.card-title .link { margin-inline-start: auto; font-size: 13px; font-weight: 400; }

/* ── Notices تحسين ── */
.notice {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 18px; border-radius: 12px; margin-bottom: 16px;
  font-size: 14px; line-height: 1.65;
  /* تنسيق محايد افتراضي — كان `.notice` بلا variant يظهر نصًا عائمًا بلا خلفية */
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
}
.notice.ok   { background: rgba(45,212,191,.06); border: 1px solid rgba(45,212,191,.2); color: var(--live); }
.notice.warn { background: rgba(245,158,11,.06); border: 1px solid rgba(245,158,11,.2); color: var(--warn); }
.notice.info { background: rgba(110,91,214,.06); border: 1px solid rgba(110,91,214,.2); color: var(--accent-ink); }
.notice i { flex-shrink: 0; margin-top: 2px; }
.notice a { color: var(--accent-ink); font-weight: 600; text-decoration: underline; }
.notice b { color: var(--text); }

/* ── Badges تحسين ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 8px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge.ok     { color: var(--live); background: rgba(45,212,191,.1); }
.badge.warn   { color: var(--warn); background: rgba(245,158,11,.1); }
.badge.danger { color: var(--danger); background: rgba(248,113,113,.1); }
.badge.muted  { color: var(--muted); background: var(--surface2); }

/* ── Chips ── */
.chip { padding: 3px 10px; border-radius: 8px; font-size: 12px; background: var(--surface2); color: var(--muted); }

/* ── Stats Cards ── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  display: flex; align-items: center; gap: 14px;
  transition: .2s;
}
.stat:hover { border-color: rgba(110,91,214,.25); transform: translateY(-1px); }
.stat i { font-size: 24px; color: var(--accent); }
.stat b { font-size: 22px; display: block; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.attn { border-color: rgba(248,113,113,.35); }
.stat.attn i { color: var(--danger); }

/* ── Form Elements تحسين ── */
label { display: block; font-size: 13.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
input, select {
  width: 100%; padding: 10px 14px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  font: inherit; font-size: 14px;
  transition: border-color .2s;
}
input:hover, select:hover { border-color: rgba(110,91,214,.3); }
input::placeholder { color: var(--muted); opacity: .6; }
.form-actions { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }

/* ── Plans Grid ── */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; margin-bottom: 20px; }
.plan {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; position: relative;
  transition: .2s;
}
.plan:hover { border-color: rgba(110,91,214,.3); transform: translateY(-2px); }
.plan.featured { border-color: var(--accent); box-shadow: 0 8px 32px rgba(110,91,214,.15); }
.plan .tag {
  position: absolute; top: -11px; inset-inline-start: 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; padding: 3px 12px; border-radius: 8px;
  font-size: 11.5px; font-weight: 700;
}
.plan h3 { margin-bottom: 8px; }
.plan .price { font-size: 36px; font-weight: 700; color: var(--accent); margin-bottom: 14px; }

@media (max-width: 600px) { .plan-grid { grid-template-columns: 1fr; } .plan { padding: 20px; } }
.plan .price span { font-size: 14px; color: var(--muted); font-weight: 400; }
.plan ul { list-style: none; padding: 0; margin: 0 0 18px; }
.plan li { padding: 5px 0; font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.plan li i { font-size: 14px; color: var(--live); }
.plans-sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 20px; }

/* ── Conversation View ── */
.conv-view { display: flex; flex-direction: column; gap: 12px; max-height: 500px; overflow-y: auto; padding: 4px 0; }
.cv-msg { padding: 12px 16px; border-radius: 14px; max-width: 85%; font-size: 14px; line-height: 1.6; }
.cv-msg.visitor { background: var(--surface2); align-self: flex-start; border-end-start-radius: 4px; }
.cv-msg.bot { background: rgba(110,91,214,.08); border: 1px solid rgba(110,91,214,.15); align-self: flex-end; border-end-end-radius: 4px; }
.cv-meta { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; display: flex; justify-content: space-between; }

/* ── Filter Tabs ── */
.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-tabs a {
  padding: 6px 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
  background: var(--surface2); color: var(--muted); transition: .15s;
}
.filter-tabs a:hover { color: var(--text); }
.filter-tabs a.active { background: var(--accent); color: #fff; }

/* ── Sidebar تحسين ── */
.side-sep { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 12px 0 4px; font-weight: 700; }

/* ── Page Head ── */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; }
.page-head h2 { margin: 0; }

/* ── Preview Chat ── */
.preview-chat { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 14px; min-height: 160px; max-height: 350px; overflow-y: auto; margin-bottom: 10px; }
.pv-msg { padding: 8px 12px; border-radius: 10px; margin-bottom: 8px; max-width: 85%; font-size: 13.5px; }
.pv-msg.bot { background: rgba(110,91,214,.08); border: 1px solid rgba(110,91,214,.12); }
.pv-msg.user { background: var(--surface2); margin-inline-start: auto; }
.preview-input { display: flex; gap: 8px; }
.preview-input input { flex: 1; }

/* ── Steps ── */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.step { text-align: center; }
.step .n {
  width: 38px; height: 38px; border-radius: 50%; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 16px;
}
.step h3 { margin-bottom: 6px; }
.step p { font-size: 13.5px; color: var(--muted); margin: 0; }

/* ── Details/Summary ── */
details summary { list-style: none; cursor: pointer; }
details summary::-webkit-details-marker { display: none; }
details[open] summary { margin-bottom: 10px; }

/* ── Loading Skeleton ── */
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.skeleton { background: linear-gradient(90deg, var(--surface2) 25%, var(--surface) 50%, var(--surface2) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 8px; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── Print ── */
@media print { .sidebar, .topbar, .btn { display: none !important; } body { background: #fff; color: #000; } .card { border: 1px solid #ddd; } }

/* ── Mobile Layout Global ── */
@media (max-width: 768px) {
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero h1 { font-size: 28px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .plan-grid { grid-template-columns: 1fr; }
}

/* ── Transition Utilities ── */
.fade-in { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ═══════════ v6 UI/UX Fixes ═══════════ */

/* ── Brand with logo ── */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; color: var(--text); text-decoration: none; }
.brand img { flex-shrink: 0; }

/* ── Sidebar head ── */
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 10px; }
.side-close { display: none; background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; padding: 6px; }

/* ── Mobile sidebar overlay ── */
.sidebar-overlay { display: none; }
@media (max-width: 768px) {
  .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 99; opacity: 0; pointer-events: none; transition: opacity .3s; }
  .sidebar-overlay.show { opacity: 1; pointer-events: auto; }
  .sidebar {
    position: fixed; inset-inline-end: 0; top: 0; bottom: 0; width: min(280px, 85vw);
    transform: translateX(100%); transition: transform .3s; z-index: 100;
    box-shadow: -8px 0 40px rgba(0,0,0,.5); padding: 16px 12px;
  }
  html[dir="rtl"] .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0) !important; }
  .side-close { display: block; }
  /* التذييل ثابت والقائمة تتمرر — يمنع اقتصاص "خروج"/الاشتراك على الشاشات القصيرة */
  .side-nav { flex: 1; min-height: 0; overflow-y: auto; }
  .main { margin-inline-start: 0 !important; padding: 16px; }
  /* حد أدنى للمس 44px على الموبايل — أزرار الجداول والصفحات كانت ~30px (أصغر من معيار اللمس) */
  .btn-mini, .pager a, .filter-tabs a { min-height: 44px; display: inline-flex; align-items: center; padding-block: 0; }
  .chip-x { min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; }
  .menu-toggle {
    display: flex; position: fixed; top: 12px; inset-inline-start: 12px; z-index: 50;
    width: 42px; height: 42px; border-radius: 12px; align-items: center; justify-content: center;
    background: var(--surface); border: 1px solid var(--border); color: var(--text);
    font-size: 18px; cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,.3);
  }
}
@media (min-width: 769px) {
  .menu-toggle { display: none; }
  .sidebar-overlay { display: none !important; }
}

/* ── Flash messages HTML support ── */
.flash { padding: 14px 20px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; animation: fadeIn .3s ease; }
.flash code { background: var(--bg); padding: 3px 8px; border-radius: 6px; font-size: 12.5px; direction: ltr; display: inline-block; user-select: all; }
.flash-ok { background: rgba(45,212,191,.08); border: 1px solid rgba(45,212,191,.2); color: var(--live); }
.flash-error { background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.2); color: var(--danger); }

/* ═══════════ Landing Page — New Design ═══════════ */

/* Hero */
/* overflow:hidden يقصّ توهج ::before ذا الإزاحة السالبة — بدونه يظهر شريط تمرير أفقي على الهاتف */
.hero { position: relative; display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center;
  padding: clamp(60px,10vw,120px) clamp(20px,5vw,80px); max-width: 1200px; margin: 0 auto; }
/* توهج بنفسجي خافت خلف البطل — عمق بلا زينة.
   يعيش على غلاف ممتد بعرض الشاشة (.hero-bleed) لا على .hero نفسه، لأن الهيرو
   محدود بـ1200px فكانت تبقى فجوة مظلمة بين التوهّج وطرف الصفحة.
   الغلاف بعرض الشاشة تمامًا + overflow:hidden فلا ينشأ تمرير أفقي.
   ⚠ محاولة سابقة استخدمت inset-inline-end:-50vw على .hero وأعادت شريط التمرير
   الأفقي (قيس: scrollWidth 1470 مقابل clientWidth 980) — لا تكررها. */
.hero-bleed { position: relative; overflow: hidden; }
.hero-bleed::before { content: ''; position: absolute; inset-inline-end: 0; top: 0;
  width: min(58%, 780px); height: 100%;
  background: radial-gradient(ellipse 70% 65% at 72% 45%, rgba(110,91,214,.18), transparent 72%);
  pointer-events: none; z-index: 0; }
.hero > * { position: relative; z-index: 1; }
.hero-copy { position: relative; }
.hero-copy h1 { font-size: clamp(32px,5vw,54px); font-weight: 700; line-height: 1.2; margin-bottom: 20px; text-wrap: balance; }
.hero-copy h1 em { font-style: normal; color: var(--accent-ink); }
.hero-copy > p { color: var(--muted); font-size: 17px; line-height: 1.75; max-width: 52ch; margin-bottom: 28px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--accent);
  background: rgba(110,91,214,.08); border: 1px solid rgba(110,91,214,.25); padding: 6px 16px; border-radius: 99px; margin-bottom: 22px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-trust { display: flex; align-items: center; gap: 8px; margin-top: 20px; font-size: 13px; color: var(--muted); }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; text-align: center; }
  .hero-copy > p { margin: 0 auto 28px; } .hero-actions { justify-content: center; } .hero-trust { justify-content: center; } }

/* Hero Visual — مشهد المنتج الحقيقي: تذكرة يرد عليها البوت، إيداع مطابَق، تحديث تليجرام */
.hero-visual { position: relative; display: flex; flex-direction: column; gap: 14px; max-width: 420px;
  margin-inline-start: auto; }
.hv-ticket { background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 18px; box-shadow: 0 24px 60px rgba(0,0,0,.45); }
.hv-t-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px;
  padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.hv-t-head i { color: var(--accent-ink); }
.hv-t-live { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: var(--live); }
/* فقاعات المحادثة — نفس منطق فقاعات المنتج الفعلي */
.hv-msg { max-width: 88%; padding: 10px 14px; border-radius: 13px; font-size: 13px; line-height: 1.7;
  margin-bottom: 10px; }
.hv-msg.cust { background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  margin-inline-start: auto; border-start-end-radius: 4px; }
.hv-msg.bot { background: rgba(110,91,214,.12); border: 1px solid rgba(110,91,214,.3); color: var(--text);
  border-start-start-radius: 4px; margin-bottom: 0; white-space: pre-line; }
/* شرائح جانبية — إيداع + تليجرام */
.hv-chip { display: flex; align-items: center; gap: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; padding: 13px 16px;
  box-shadow: 0 12px 32px rgba(0,0,0,.3); }
.hv-chip > i { font-size: 20px; color: var(--accent-ink); }
.hv-c-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hv-c-body b { font-size: 13.5px; }
.hv-c-body span { font-size: 12px; color: var(--muted); }
.hv-c-ok { margin-inline-start: auto; width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
  color: var(--live); background: rgba(45,212,191,.12); border: 1px solid rgba(45,212,191,.3); }
.hv-dep { margin-inline-end: 34px; }
.hv-tg  { margin-inline-start: 34px; }
/* دخول متدرّج للمشهد مع الصفحة (يكمل تسلسل rise في البطل) */
html.js .hv-ticket, html.js .hv-chip { animation: rise .6s cubic-bezier(.16,1,.3,1) both; }
html.js .hv-ticket { animation-delay: .25s; }
html.js .hv-dep    { animation-delay: .45s; }
html.js .hv-tg     { animation-delay: .6s; }
@media (prefers-reduced-motion: reduce) {
  html.js .hv-ticket, html.js .hv-chip { animation: none; }
}
/* موبايل: المشهد مكدّس تحت النص — يبقى شارحًا للمنتج */
@media (max-width: 900px) {
  .hero-visual { max-width: 420px; margin: 6px auto 0; }
  .hv-dep, .hv-tg { margin-inline: 0; }
}

/* Section Heads */
.section-head { text-align: center; max-width: 600px; margin: 0 auto 40px; }
.section-head h2 { font-size: clamp(26px,3.5vw,38px); margin-bottom: 10px; }
.section-head p { color: var(--muted); font-size: 16px; }

/* Features — شبكة bento: بطاقة رائدة عريضة، بطاقات وسط، بانر بريميوم أفقي */
.features { padding: 80px clamp(20px,5vw,80px); max-width: 1200px; margin: 0 auto; }
.feature-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.feature-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 28px; transition: border-color .25s, transform .25s cubic-bezier(.25,1,.5,1), box-shadow .25s; }
.feature-card:hover { border-color: rgba(110,91,214,.3); transform: translateY(-4px); box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.feature-card.fc-gold { border-color: rgba(232,197,116,.3); }
.feature-card.fc-gold:hover { border-color: rgba(232,197,116,.5); box-shadow: 0 12px 40px rgba(232,197,116,.1); }
.fc-icon { font-size: 28px; color: var(--accent-ink); margin-bottom: 16px; }
.fc-gold .fc-icon { color: var(--gold); }
.feature-card h3 { font-size: 20px; margin-bottom: 10px; }
.feature-card > p, .fc-wide-copy > p, .fc-banner-copy > p { color: var(--muted); font-size: 14px; line-height: 1.7; margin-bottom: 16px; }
.fc-list { list-style: none; padding: 0; margin: 0 0 16px; }
.fc-list li { padding: 4px 0; font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.fc-list li::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.fc-gold .fc-list li::before { background: var(--gold); }
.fc-price { font-size: 15px; font-weight: 700; color: var(--accent-ink); }
.fc-price.gold { color: var(--gold); }

/* البطاقة الرائدة (الرد الآلي) — عرض كامل + معاينة محادثة حقيقية */
.fc-wide { grid-column: 1 / -1; display: grid; grid-template-columns: 1.1fr .9fr; gap: 32px;
  align-items: center; background: linear-gradient(160deg, var(--surface), rgba(110,91,214,.06)); }
.fc-wide h3 { font-size: 23px; }
.fc-demo { background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.fc-demo-live { display: flex; align-items: center; gap: 7px; margin-top: 12px;
  font-size: 11.5px; font-weight: 600; color: var(--live); }
@media (max-width: 800px) { .fc-wide { grid-template-columns: 1fr; } }

/* بانر الثيمات البريميوم — أفقي مميز، ليس بطاقة مكررة */
.fc-banner { grid-column: 1 / -1; display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  background: linear-gradient(160deg, var(--surface), rgba(232,197,116,.05)); }
.fc-banner .fc-icon { margin-bottom: 0; font-size: 32px; }
.fc-banner-copy { flex: 1; min-width: 260px; }
.fc-banner-copy h3 { margin-bottom: 6px; }
.fc-banner-copy > p { margin-bottom: 10px; }
.fc-banner .fc-price { flex-shrink: 0; font-size: 17px; }
.fc-list-inline { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; }
.fc-list-inline li { padding: 2px 0; }

@media (max-width: 700px) { .feature-grid { grid-template-columns: 1fr; } }

/* How It Works — تسلسل حقيقي (3 خطوات) بخط واصل */
.how-section { padding: 80px clamp(20px,5vw,80px); max-width: 1000px; margin: 0 auto; }
.how-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.how-step { position: relative; text-align: center; padding: 24px; }
/* الخط الواصل بين الأرقام — يوضح أنها رحلة واحدة */
.how-step:not(:last-child)::after { content: ''; position: absolute; top: 48px;
  inset-inline-start: calc(50% + 36px); width: calc(100% - 72px); height: 1px;
  background: var(--border); }
.hs-num { width: 48px; height: 48px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 20px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px; box-shadow: 0 8px 24px rgba(110,91,214,.3); }
.how-step h3 { font-size: 18px; margin-bottom: 8px; }
.how-step p { color: var(--muted); font-size: 14px; }
@media (max-width: 700px) {
  .how-steps { grid-template-columns: 1fr; }
  .how-step:not(:last-child)::after { display: none; }
}

/* CTA — لوحة ملتزمة بلون العلامة مع توهج */
.cta-section { padding: 60px clamp(20px,5vw,80px) 80px; max-width: 800px; margin: 0 auto; }
.cta-box { position: relative; overflow: hidden; text-align: center; padding: 56px 32px; border-radius: 20px;
  background: linear-gradient(160deg, rgba(110,91,214,.16), rgba(110,91,214,.04));
  border: 1px solid rgba(110,91,214,.3); }
.cta-box::before { content: ''; position: absolute; top: -60%; inset-inline-start: 50%;
  transform: translateX(-50%); width: 70%; height: 120%;
  background: radial-gradient(ellipse at center, rgba(155,124,255,.18), transparent 65%);
  pointer-events: none; }
.cta-box > * { position: relative; }
.cta-box h2 { font-size: clamp(24px,3vw,32px); margin-bottom: 12px; text-wrap: balance; }
.cta-box p { color: var(--muted); margin-bottom: 26px; }

/* Scroll Animations — الإخفاء الأولي فقط عندما يكون JS شغالًا فعلًا (html.js تُضاف من app.js).
   بدون JS أو مع ملف قديم/فاشل: كل العناصر ظاهرة طبيعيًا — لا محتوى مخفيًا للأبد. */
[data-anim] { transition: opacity .6s ease, transform .6s ease; }
html.js [data-anim] { opacity: 0; transform: translateY(20px); }
html.js [data-anim].visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { html.js [data-anim] { opacity: 1; transform: none; transition: none; } }

/* ═══════════ Responsive Fixes ═══════════ */
@media (max-width: 768px) {
  .hero { grid-template-columns: 1fr; text-align: center; padding: 40px 16px; }
  .hero-actions { justify-content: center; }
  .hero-trust { justify-content: center; }
  .feature-grid { grid-template-columns: 1fr; }
  .how-steps { grid-template-columns: 1fr; gap: 16px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px; }
  .stat b { font-size: 18px; }
  .grid-2 { grid-template-columns: 1fr; }
  .plan-grid { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
  .topbar nav { gap: 6px; }
  .topbar .btn { padding: 8px 12px; font-size: 13px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .card { padding: 16px; }
  .table { font-size: 12.5px; }
  .table td, .table th { padding: 8px 6px; }
  .filter-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .ob-features { grid-template-columns: 1fr; }
  .ob-plans { grid-template-columns: 1fr 1fr; }
  .cta-box { padding: 32px 20px; }
  .cta-box h2 { font-size: 22px; }
  .auth-wrap { padding: 20px 16px; }
  .main { padding: 16px !important; }
}

@media (max-width: 480px) {
  .ob-plans { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
  /* لا نُخفي كل أزرار الشريط (كان يخفي اللغة والدخول). نُبقي اللغة والدخول/التسجيل
     ونُخفي فقط الرابط الزخرفي "الثيمات"، مع السماح للشريط بالالتفاف. */
  .topbar nav { gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  .topbar .btn { padding: 8px 12px; font-size: 13px; }
  .topbar-optional { display: none; }
  .hero h1 { font-size: 26px; }
  .section-head h2 { font-size: 22px; }
}


/* ═══════════ Topbar + جرس الإشعارات ═══════════ */
.app-topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.app-topbar .menu-toggle { margin-bottom: 0; }
.app-topbar-spacer { flex: 1; }
.notif-wrap { position: relative; }
.notif-bell {
  position: relative; width: 42px; height: 42px; border-radius: 12px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font-size: 17px; display: grid; place-items: center; transition: .15s;
}
.notif-bell:hover { border-color: var(--accent); color: var(--accent); }
.notif-badge {
  position: absolute; top: -5px; inset-inline-end: -5px; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700; display: grid; place-items: center; line-height: 1;
}
.notif-dropdown {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0; width: min(360px, 92vw);
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0,0,0,.45); z-index: 90; overflow: hidden;
}
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.notif-mark { background: none; border: 0; color: var(--accent); font: inherit; font-size: 12.5px; cursor: pointer; }
.notif-list { max-height: 320px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; align-items: flex-start; padding: 11px 16px; border-bottom: 1px solid rgba(35,43,64,.5); font-size: 13px; }
.notif-item.unread { background: rgba(110,124,255,.06); }
.notif-item i { color: var(--accent); margin-top: 2px; }
.notif-item .t { font-weight: 600; }
.notif-item .b { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.notif-item .d { color: var(--muted); font-size: 11px; margin-top: 3px; }
.notif-item .x { margin-inline-start: auto; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; padding: 2px 4px; }
.notif-item .x:hover { color: var(--danger); }
.notif-empty { padding: 24px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.notif-all { display: block; text-align: center; padding: 11px; font-size: 13px; color: var(--accent); border-top: 1px solid var(--border); }
@media (max-width: 768px) {
  .app-topbar { padding-top: 0; }
  .app-topbar .menu-toggle { position: static; }
  .main { padding-top: 16px; }
}

/* ── مبدّل اللغة ── */
.lang-switch {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font-size: 13px; font-weight: 700; transition: .15s;
}
.lang-switch:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ── تناسق الموبايل: الجداول تتمرر أفقيًا داخل بطاقاتها بدل كسر عرض الصفحة ── */
@media (max-width: 768px) {
  .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card .table { min-width: 560px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .grid-2 { grid-template-columns: 1fr !important; }
  .form-actions .btn { width: 100%; justify-content: center; }
  .plan-grid { grid-template-columns: 1fr; }
  .filter-tabs { flex-wrap: wrap; }
}

/* ── مبدّل الفترة (شهري/سنوي) ── */
.period-toggle { display: inline-flex; background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 3px; }
.pt-btn { border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; font-size: 13px; padding: 7px 16px; border-radius: 9px; cursor: pointer; transition: .15s; display: inline-flex; align-items: center; gap: 6px; }
.pt-btn.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 3px 10px rgba(110,91,214,.28); }
.pt-save { font-size: 10.5px; background: rgba(45,212,191,.18); color: var(--live); padding: 1px 7px; border-radius: 99px; font-weight: 700; }
.pt-btn.active .pt-save { background: rgba(255,255,255,.2); color: #fff; }

/* ═══════════ تناسق الموبايل — تصغير الحشوات/الخطوط + شريط جانبي متّسق ═══════════
   (كانت خطوط ح1/البطاقات/الإحصائيات بمقاس سطح المكتب على الموبايل = صفحات ضخمة) */
@media (max-width: 768px) {
  .main { padding: 14px 13px 44px; }
  .page-head { margin-bottom: 16px; }
  .page-head h1 { font-size: 19px; }
  .card { padding: 16px; margin-bottom: 14px; }
  .card-title { font-size: 15px; margin-bottom: 12px; }
  .notice { padding: 12px 14px; font-size: 13px; }

  /* الإحصائيات: عمودان متناسقان بمقاس أصغر */
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
  .stat { padding: 13px; gap: 10px; }
  .stat i { font-size: 19px; }
  .stat b { font-size: 20px; }
  .stat span { font-size: 12px; }

  /* الشريط الجانبي (overlay): عناصر متساوية الشكل والحجم */
  .sidebar { padding: 14px 12px; }
  .sidebar .brand, .side-head { font-size: 18px; }
  .side-nav { gap: 3px; }
  .side-nav a { padding: 10px 12px; font-size: 14px; gap: 10px; border-radius: 9px; }
  .side-nav a i { font-size: 15px; width: 18px; text-align: center; }
  .side-sep { padding: 12px 12px 3px; font-size: 10.5px; }

  /* النماذج والأزرار — تصغير موحّد لكل الصفحات (كان panel.php يبقى بحجم سطح المكتب) */
  label { margin-top: 14px; font-size: 13.5px; }
  input, select, textarea { padding: 10px 12px; font-size: 14px; border-radius: 10px; }
  /* 16px يمنع تكبير iOS التلقائي عند التركيز — لكل الحقول النصية بما فيها بلا type
     (input بلا type = text ضمنيًا)، ونستثني الحقول غير النصية بمحدد :not */
  input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="submit"]):not([type="button"]),
  textarea, select { font-size: 16px; }
  .hint { font-size: 12.5px; line-height: 1.65; }
  .grid-2 { grid-template-columns: 1fr; gap: 0; }
  .switch-row { margin-top: 14px; gap: 10px; }
  .switch-row b { font-size: 14px; }
  .snippet { font-size: 12px; padding: 12px 13px; }
  .btn { padding: 10px 16px; font-size: 14px; }
  .form-actions { margin-top: 18px; }
  .form-actions .btn { flex: 1; justify-content: center; }
}
@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 18px; }
  .card { padding: 14px; }
  .notice { padding: 11px 12px; font-size: 12.5px; }
}

/* ═══════════ الصفحة الرئيسية: شريط الأرقام + الأسئلة الشائعة ═══════════ */
.stats-band { max-width: 1100px; margin: 0 auto; padding: 8px clamp(20px,5vw,80px); }
.stats-band .sb-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: clamp(20px,3vw,30px);
}
.sb-item { text-align: center; padding: 6px; }
.sb-n { font-size: clamp(21px,3vw,29px); font-weight: 800; color: var(--accent-ink); line-height: 1.2; }
.sb-l { color: var(--muted); font-size: 13px; margin-top: 5px; line-height: 1.5; }
.sb-item + .sb-item { border-inline-start: 1px solid var(--border); }
@media (max-width: 760px) {
  .stats-band .sb-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .sb-item:nth-child(odd) { border-inline-start: 0; }
}
@media (max-width: 420px) {
  .stats-band .sb-grid { grid-template-columns: 1fr; }
  .sb-item + .sb-item { border-inline-start: 0; border-top: 1px solid var(--border); }
}

.faq-section { max-width: 820px; margin: 0 auto; padding: 70px clamp(20px,5vw,80px); }
.faq-list { display: flex; flex-direction: column; gap: 12px; margin-top: 30px; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; transition: border-color .15s; }
.faq-item[open] { border-color: rgba(110,91,214,.4); }
.faq-item summary {
  cursor: pointer; padding: 17px 20px; font-weight: 600; font-size: 15px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px; list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font-size: 22px; color: var(--accent-ink); transition: transform .2s; flex-shrink: 0; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .faq-a { padding: 0 20px 18px; color: var(--muted); font-size: 14px; line-height: 1.75; }

/* ═══════════ زر واتساب العائم (كل الصفحات) ═══════════ */
.wa-float {
  position: fixed; bottom: 22px; inset-inline-end: 22px; z-index: 900;
  /* ألوان الموقع بدل أخضر واتساب — الزر جزء من الهوية لا شعار طرف ثالث.
     نفس تدرّج الأكسنت وشعاعه المستخدم في الأزرار الأساسية، وحواف 14px
     (‎--radius‎) بدل الدائرة الكاملة ليطابق لغة الأشكال في باقي الواجهة. */
  width: 54px; height: 54px; border-radius: var(--radius);
  background: var(--accent); color: #fff;   /* لون مسطّح واحد — بلا تدرّج */
  display: grid; place-items: center;
  box-shadow: 0 6px 20px rgba(110,91,214,.35); transition: transform .15s, box-shadow .15s;
}
.wa-float:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(110,91,214,.5); }
.wa-float:active { transform: scale(.96); }
.wa-float i { font-size: 26px; line-height: 1; }
@media (max-width: 768px) { .wa-float { width: 48px; height: 48px; bottom: 16px; inset-inline-end: 16px; } .wa-float i { font-size: 23px; } }

/* ── زر قناة تيليجرام في الشريط العلوي (نفس نمط .lang-switch) ── */
.tg-link {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font-size: 17px; transition: .15s;
}
.tg-link:hover { border-color: #229ED9; color: #229ED9; }

/* ═══════════ شبكة حالة الاشتراكات لكل منتج (صفحة الفوترة) ═══════════ */
.sub-status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.ssc { border: 1px solid var(--border); border-radius: 14px; padding: 15px; background: var(--bg);
  display: flex; flex-direction: column; gap: 7px; align-items: flex-start; }
.ssc.on { border-color: rgba(45,212,191,.32); }
.ssc-head { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.ssc-head i { color: var(--accent); font-size: 16px; }
.ssc-plan { font-size: 13px; font-weight: 600; }
.ssc-meta { font-size: 12px; }
.ssc-btn { margin-top: auto; }
@media (max-width: 480px) { .sub-status-grid { grid-template-columns: 1fr; } }
