/* P.R.M Bot v13.1 — طبقة الجوال الموحّدة (تنحمّل آخر شي بكل الصفحات)
   كل القواعد داخل media queries للجوال/اللمس عشان شكل الكمبيوتر ما يتغير.
   بدون خطوط/روابط خارجية وبدون ستايل داخلي (CSP) — هوية P.R.M: #10B981 على أسود */
:root{--m-or:#10B981;--m-bg:#0c0b09;--m-line:#10b98133;--m-pad:clamp(12px,3.6vw,18px);
  --m-safe-t:env(safe-area-inset-top,0px);--m-safe-b:env(safe-area-inset-bottom,0px);--m-safe-l:env(safe-area-inset-left,0px);--m-safe-r:env(safe-area-inset-right,0px)}

/* بنص الصفحة: لوحة التحكم المخفية ما تنعرض تحت صفحة الهبوط (fit.css كان يفرض .app{display:block!important}) */
#app.app.hidden{display:none!important}

@media (max-width:899px){
  /* ---------- ما فيه سكرول أفقي أبد ---------- */
  html,body{max-width:100%;overflow-x:hidden}
  @supports (overflow:clip){html,body{overflow-x:clip}}
  html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
  body{-webkit-tap-highlight-color:transparent}
  img,svg,video,canvas{max-width:100%}
  .content,.content>*,.card,.dash-panel,.field,.fields,.row,.grid,.cards{min-width:0;max-width:100%}
  .card,.dash-panel,.modal,.s10-card{overflow-wrap:anywhere}
  pre,code{white-space:pre-wrap;overflow-wrap:anywhere}
  a.btn,.btn{text-decoration:none!important}

  /* ---------- الهيكل: padding موحّد + مساحة الأمان ---------- */
  .main{padding:0 calc(var(--m-pad) + var(--m-safe-r)) calc(28px + var(--m-safe-b)) calc(var(--m-pad) + var(--m-safe-l))!important}

  /* ---------- الشريط العلوي (mobilebar): ثابت ومضغوط ---------- */
  .mobilebar{position:sticky!important;top:0;z-index:40;display:flex!important;align-items:center;gap:10px;
    margin:0 calc(-1*(var(--m-pad) + var(--m-safe-r))) 14px calc(-1*(var(--m-pad) + var(--m-safe-l)))!important;
    padding:calc(8px + var(--m-safe-t)) calc(var(--m-pad) + var(--m-safe-r)) 8px calc(var(--m-pad) + var(--m-safe-l))!important;
    min-height:calc(58px + var(--m-safe-t));background:#0f0d0bf2!important;border-bottom:1px solid #2a221b!important;
    -webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px)}
  .mobilebar .icon-btn{width:44px!important;height:44px!important;min-height:44px;flex:none;border-radius:13px}
  .mobilebar .brand.mini{flex:1;justify-content:center;min-width:0}
  .mobilebar .brand.mini b{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

  /* ---------- رأس الصفحة (topbar): أقصر وبصف واحد للأزرار ---------- */
  .topbar{display:flex!important;flex-direction:column!important;align-items:stretch!important;gap:10px!important;
    padding:14px!important;margin:0 0 14px!important;border-radius:18px}
  .topbar .title-wrap{width:100%;min-width:0}
  .topbar h1{font-size:clamp(19px,5.4vw,23px)!important;line-height:1.35;margin:2px 0}
  .topbar #pageDesc{font-size:13px;line-height:1.75;display:-webkit-box!important;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
  .topbar .crumb{font-size:11.5px}
  .top-actions{display:flex!important;flex-wrap:nowrap!important;align-items:center;gap:8px!important;width:100%!important;
    overflow-x:auto;overflow-y:hidden;scrollbar-width:none;padding:2px 0;justify-content:flex-start!important}
  .top-actions::-webkit-scrollbar{display:none}
  .top-actions>*{flex:none!important}
  .topbar #searchBtn{display:none!important} /* البحث موجود بزر 🔍 بالشريط العلوي */
  .topbar #inviteBotBtn,.topbar #serversBtn{display:none!important}
  .top-actions .icon-btn{width:44px!important;height:44px!important;min-height:44px}
  .top-actions .btn.sm{min-height:44px;padding-inline:14px;white-space:nowrap}
  .topbar .pill{margin-inline-start:auto!important;max-width:none!important;white-space:nowrap;align-self:center}

  .banner{margin:0 0 14px!important;font-size:13.5px;line-height:1.8;border-radius:14px}

  /* ---------- القائمة الجانبية: درج فوق المحتوى + طبقة تعتيم ---------- */
  .sidebar{width:min(86vw,330px)!important;max-width:min(86vw,330px)!important;height:100dvh!important;max-height:100dvh;
    overflow-y:auto!important;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;
    padding-top:calc(14px + var(--m-safe-t))!important;padding-bottom:calc(18px + var(--m-safe-b))!important;padding-inline-start:calc(14px + var(--m-safe-r))!important}
  .sidebar>*{flex-shrink:0!important}
  .sidebar #nav{flex:none!important;overflow:visible!important;min-height:0!important}
  .nav-overlay{display:block!important;position:fixed;inset:0;opacity:0;pointer-events:none;transition:opacity .2s;background:#050403cc!important;z-index:55!important}
  .nav-open .nav-overlay{opacity:1;pointer-events:auto}
  body.nav-open{overflow:hidden!important}
  .side-hub{min-height:44px!important}
  .side-toggle{min-width:44px!important;min-height:44px!important}
  .nav-item{min-height:44px}
  #logout,.owner-card .icon-btn{width:44px!important;height:44px!important}

  /* ---------- لمس: أهداف 44px ---------- */
  .icon-btn.sm{width:44px!important;height:44px!important;min-height:44px}
  .seg>button,.seg button,.tabs>button,.tab-btn,[role=tab]{min-height:44px;min-width:44px}
  .sw{width:40px!important;height:40px!important}
  .var,.chip{min-height:36px;display:inline-flex;align-items:center;gap:6px}
  .btn{min-height:44px}
  .btn.xs{min-height:36px}

  /* مربعات الاختيار العادية (مو مفاتيح التشغيل) كانت تتمدد لمربع كبير */
  #content input[type=checkbox]:not(.switch input),.modal input[type=checkbox]:not(.switch input),
  #content input[type=radio],.modal input[type=radio]{width:22px!important;height:22px!important;min-width:22px;min-height:0!important;max-width:22px;
    flex:none!important;padding:0!important;margin:0;border-radius:6px;accent-color:var(--m-or);font-size:inherit!important}
  .display-choice{display:flex!important;align-items:center;gap:12px}
  .display-choice>div{flex:1;min-width:0}

  /* ---------- الحقول: 16px يمنع تكبير سفاري ---------- */
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),select,textarea{font-size:16px!important;max-width:100%}
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]),select{min-height:46px}
  .field,.fields,label{min-width:0}

  /* ---------- الجداول: تسكرول داخل الحاوية بس ---------- */
  .table-wrap,.o13-table-wrap{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;overscroll-behavior-inline:contain;border-radius:12px}

  /* ---------- النوافذ المنبثقة ---------- */
  .modal-ov{padding:calc(10px + var(--m-safe-t)) 10px calc(10px + var(--m-safe-b))!important;align-items:flex-end!important}
  .modal{width:100%!important;max-width:560px!important;max-height:calc(100dvh - 20px - var(--m-safe-t) - var(--m-safe-b))!important;overflow-y:auto;
    -webkit-overflow-scrolling:touch;overscroll-behavior:contain;border-radius:20px!important;margin:0 auto}
  .modal .row:last-child .btn,.modal>.btn{flex:1 1 auto}
  /* نتائج البحث السريع كانت تتراكب فوق بعض */
  .command-results{display:flex!important;flex-direction:column;gap:6px;overflow-y:auto;max-height:min(56dvh,460px)!important}
  .command-result{flex:none!important;height:auto!important;min-height:56px!important;align-items:center}
  .command-result small{white-space:normal}

  /* ---------- شريط الحفظ والتوست ---------- */
  .savebar{left:10px!important;right:10px!important;bottom:calc(10px + var(--m-safe-b))!important;flex-wrap:wrap;gap:8px;padding:10px!important;border-radius:16px}
  .savebar>span{flex:1 1 100%;text-align:center;font-size:13px}
  .savebar>div{display:flex;gap:6px;width:100%}
  .savebar>div .btn{flex:1 1 0;min-width:0;padding-inline:8px}
  body:has(.savebar:not(.hidden)) .main{padding-bottom:calc(130px + var(--m-safe-b))!important}
  .toast,.s10-toast{bottom:calc(14px + var(--m-safe-b))!important}

  /* ---------- الصفحة الرئيسية للوحة ---------- */
  .dash-welcome h2{font-size:clamp(22px,6.4vw,27px)!important}

  /* ---------- الوحدات ---------- */
  .b13-cols,.p13-plans{grid-template-columns:minmax(0,1fr)!important}
  .p13-plan .btn,.p13-current .btn{width:100%}
  .n13-tools{display:flex;flex-wrap:wrap}
  .n13-tools select{max-width:none!important;flex:1 1 100%}
  .n13-tools .btn{flex:1 1 auto}
  .n13-chips{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;padding-bottom:2px}
  .n13-chips::-webkit-scrollbar{display:none}
  .n13-chips .chip{flex:none;white-space:nowrap}
}

/* ---------- جوالات بالطول (≤600) ---------- */
@media (max-width:600px){
  .row>.btn,.form-actions .btn,.card>.btn:last-child,.s10-row .btn{flex:1 1 auto}
  .b13-tpls{grid-template-columns:minmax(0,1fr)!important}
  .b13-tpl{flex-direction:row;flex-wrap:wrap;align-items:center;column-gap:12px}
  .b13-tpl .b13-emoji{font-size:26px}
  .b13-tpl b{flex:1}
  .b13-tpl small,.b13-tpl .b13-meta{flex:1 1 100%}
}

/* ---------- صفحة الهبوط (الدخول) ---------- */
@media (max-width:899px){
  .login-v6{min-height:100dvh}
  .login-story{padding:calc(18px + var(--m-safe-t)) calc(18px + var(--m-safe-r)) 26px calc(18px + var(--m-safe-l))!important}
  .login-story .hero-banner{border-radius:18px;width:100%;height:auto}
  .login-tag{display:inline-flex!important;align-self:flex-start;width:auto!important;max-width:100%;padding:6px 14px!important;font-size:12.5px!important;line-height:1.5;white-space:normal;text-align:center}
  .login-story h1{font-size:clamp(34px,10.6vw,46px)!important;line-height:1.3!important;letter-spacing:-.5px!important;margin:14px 0 10px!important}
  .login-story h1 br{display:inline!important}
  .login-story>p{font-size:15.5px!important;line-height:1.95!important;color:#d8cfc6}
  .hero-cta{display:flex!important;flex-direction:column;gap:10px;width:100%}
  .hero-cta .btn,.login-story .prm-support-btn{width:100%;min-height:52px;font-size:15.5px!important;justify-content:center;border-radius:14px}
  .login-highlights{grid-template-columns:minmax(0,1fr)!important;gap:8px}
  .login-highlights>div{display:flex;align-items:center;gap:12px;padding:12px 14px;min-height:52px}
  .login-access{padding:0 calc(14px + var(--m-safe-r)) 18px calc(14px + var(--m-safe-l))!important}
  .login-card{padding:22px 18px!important;border-radius:22px!important}
  .login-card h2{font-size:clamp(22px,6.4vw,27px)!important}
  .login-card .btn.wide{min-height:52px;font-size:15.5px}
  .owner-access summary,.login-help summary{min-height:44px;display:flex;align-items:center;gap:6px;cursor:pointer}
  .password-wrap button{min-height:44px;min-width:56px}

  /* القسم التسويقي */
  .lp{padding:24px calc(14px + var(--m-safe-r)) calc(36px + var(--m-safe-b)) calc(14px + var(--m-safe-l))!important}
  .lp-nav{display:flex!important;flex-wrap:nowrap!important;justify-content:flex-start!important;width:100%!important;overflow-x:auto;scrollbar-width:none;
    border-radius:16px!important;padding:6px!important;gap:4px!important;margin-bottom:22px!important;top:var(--m-safe-t)!important}
  .lp-nav::-webkit-scrollbar{display:none}
  .lp-nav a{flex:none;min-height:44px;display:inline-flex;align-items:center;padding:0 14px!important;font-size:14px!important;white-space:nowrap}
  .lp-sec{padding:26px 0!important}
  .lp-head h2{font-size:clamp(25px,7.4vw,32px)!important;line-height:1.4}
  .lp-head p{font-size:15px;line-height:1.95}
  /* كروت المميزات والأسعار تظهر مباشرة بالجوال (كانت مخفية لين تظهر بالسكرول وتبان الصفحة فاضية بالسكرول السريع) */
  .lp-feat,.lp-plan{opacity:1!important;transform:none!important}
  .lp-sections,.lp-grid{grid-template-columns:minmax(0,1fr)!important}
  .lp-feat{padding:18px!important}
  .lp-feat.wide{grid-column:auto!important}
  .lp-feat p,.lp-secfeats span{font-size:14px!important;line-height:1.85!important}
  .lp-secfeats b{font-size:14.5px}
  .lp-plans{grid-template-columns:minmax(0,1fr)!important;gap:16px!important}
  .lp-plan{padding:22px 18px!important}
  .lp-plan.hot{margin-top:8px}
  .lp-plan .btn,.lp-cta .btn{width:100%;min-height:50px}
  .lp-cta .row{flex-direction:column;gap:10px;width:100%}
  .lp-pay{flex-wrap:wrap;justify-content:center}
  .lp-faq summary{min-height:52px;display:flex;align-items:center;font-size:15px}
  .lp-faq p{font-size:14.5px;line-height:1.9}
  .lp-foot{padding-bottom:calc(10px + var(--m-safe-b))}
}

/* ---------- صفحات الدعم والمالك (s10) ---------- */
@media (max-width:760px){
  .s10-top{position:sticky;top:0;z-index:30;display:flex;flex-wrap:nowrap!important;align-items:center;gap:8px;
    padding:calc(8px + var(--m-safe-t)) calc(12px + var(--m-safe-r)) 8px calc(12px + var(--m-safe-l))!important;
    background:#0f0d0bf2;border-bottom:1px solid #2a221b;-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px)}
  .s10-brand{flex:none;min-width:0;gap:8px}
  .s10-brand small{display:none}
  .s10-nav{display:flex;flex-wrap:nowrap!important;gap:6px;overflow-x:auto;scrollbar-width:none;margin-inline-start:auto;min-width:0}
  .s10-nav::-webkit-scrollbar{display:none}
  .s10-nav .btn{flex:none;min-height:44px;white-space:nowrap;padding-inline:12px;font-size:13px}
  .s10-main{padding:14px calc(12px + var(--m-safe-r)) calc(30px + var(--m-safe-b)) calc(12px + var(--m-safe-l))!important}
  .s10-head{flex-direction:column;align-items:stretch!important;gap:10px}
  .s10-head h1{font-size:clamp(21px,6.2vw,26px)}
  .s10-actions{display:flex;flex-wrap:wrap;gap:8px}
  .s10-actions .btn,.s10-tabs{flex:1 1 auto}
  .s10-tab{min-height:44px}
  .s10-split{grid-template-columns:minmax(0,1fr)!important}
  .s10-has-thread .s10-list-wrap{display:none}
  .s10-item-btn{min-height:56px}
  .s10-messages{max-height:none}
  .s10-row{display:flex;flex-wrap:wrap;gap:8px}
  .s10-row .btn{flex:1 1 auto}
  .s10-cards{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px}
  .s10-grid{grid-template-columns:minmax(0,1fr)!important}
  .s10-card{padding:16px!important;border-radius:16px}
  .s10-center .btn{width:100%;min-height:50px}
  input,select,textarea{font-size:16px!important}
  /* جدول اشتراكات المالك → كروت فوق بعض */
  .o13-filter{flex-direction:column;align-items:stretch}
  .o13-filter input{max-width:none!important;min-height:46px}
  .o13-table-wrap{overflow:visible!important}
  .o13-table,.o13-table tbody,.o13-table tr,.o13-table td{display:block;width:100%;min-width:0!important}
  .o13-table thead{display:none}
  .o13-table tr{border:1px solid #ffffff14;border-radius:14px;padding:12px;margin-bottom:10px;background:#ffffff05}
  .o13-table td{border:0!important;padding:6px 0!important;text-align:start}
  .o13-table td[data-label]::before{content:attr(data-label);display:block;font-size:11.5px;color:#b9b0a8;margin-bottom:3px}
  .o13-actions{display:flex!important;flex-wrap:wrap;gap:8px}
  .o13-actions>*{flex:1 1 auto;min-height:44px}
  .o13-actions input,.o13-actions select{min-width:0;flex:1 1 40%}
}

/* ---------- جوالات صغيرة (≤380) ---------- */
@media (max-width:380px){
  :root{--m-pad:10px}
  .topbar{padding:12px!important}
  .login-story h1{font-size:clamp(30px,10vw,38px)!important}
  .s10-cards{grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important}
}

/* ---------- الجوال بالعرض (ارتفاع قصير) ---------- */
@media (max-height:500px) and (orientation:landscape) and (max-width:950px){
  .mobilebar{min-height:calc(50px + var(--m-safe-t));padding-top:calc(4px + var(--m-safe-t))!important;padding-bottom:4px!important}
  .topbar{flex-direction:row!important;flex-wrap:wrap!important;align-items:center!important}
  .topbar .title-wrap{flex:1 1 280px}
  .top-actions{width:auto!important;flex:1 1 300px}
  .topbar #pageDesc{-webkit-line-clamp:1}
  .sidebar{width:min(60vw,340px)!important;max-width:min(60vw,340px)!important}
  .sidebar .hub-tabs{grid-template-columns:repeat(6,minmax(0,1fr))!important}
  .modal{max-height:calc(100dvh - 16px)!important}
  .modal-ov{align-items:center!important}
  .command-results{max-height:46dvh!important}
  .login-story{padding-inline:calc(22px + var(--m-safe-l))!important}
  .login-story h1{font-size:clamp(24px,5vw,32px)!important}
  .login-story h1 br{display:none!important}
  .hero-cta{flex-direction:row!important;flex-wrap:wrap}
  .hero-cta .btn{flex:1 1 200px;width:auto}
  .lp-sections,.lp-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .lp-plans{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:10px!important}
  .s10-top{padding-top:calc(4px + var(--m-safe-t))!important}
}
@media (max-width:899px) and (min-width:700px){
  .lp-sections,.lp-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}

@media (prefers-reduced-motion:reduce){
  .sidebar,.nav-overlay{transition:none!important}
}
