/* PishkhanPlus 2.41.0 — اصلاحات نهایی ظاهر + پنل همگام‌سازی
   [1] رفع جابه‌جایی پنجره‌ها در موبایل:
       base.css پنجره‌ها را با top:50% و translateY(-50%) وسط می‌گذاشت و
       release-2393 بعداً top/bottom ثابت داد ولی transform را خنثی نکرد؛
       نتیجه: نیمی از پنجره (از جمله «تعیین رمز اختصاصی») بالای صفحه و خارج از دید بود. */
@media (max-width: 760px), (pointer: coarse) and (hover: none) {
  html body #layer > .dlg,
  html body #layer > .wiz,
  html body #layer > .pal {
    transform: none !important;
    top: calc(max(8px, env(safe-area-inset-top, 0px)) + 4px) !important;
    bottom: auto !important;
    height: auto !important;
    max-height: calc(100dvh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
  }
}
@media (orientation: landscape) and (max-height: 520px) and (pointer: coarse) {
  html body #layer > .dlg, html body #layer > .wiz { top: 4px !important; max-height: calc(100dvh - 8px) !important; }
}

/* [2] پنل همگام‌سازی ابری */
.ppsync-box .ppsync-state{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:12px;background:var(--panel-2,#f4f7fb);border:1px solid var(--line,#dce5ef);margin-bottom:12px;line-height:1.9}
.ppsync-box .ppsync-dot{flex:0 0 auto;width:10px;height:10px;border-radius:50%;background:#9aa7b6}
.ppsync-box .ppsync-dot.ok{background:#1f9d61;box-shadow:0 0 0 4px rgba(31,157,97,.15)}
.ppsync-box .ppsync-dot.warn{background:#d99a38;box-shadow:0 0 0 4px rgba(217,154,56,.15)}
.ppsync-box .ppsync-dot.bad{background:#d04848;box-shadow:0 0 0 4px rgba(208,72,72,.15)}
.ppsync-box .ppsync-dot.busy{background:#2f6fd6;animation:ppsyncPulse 1s ease-in-out infinite}
@keyframes ppsyncPulse{50%{opacity:.35}}
.ppsync-box .ppsync-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.ppsync-box .ppsync-grid .fl.w{grid-column:1/-1}
.ppsync-box .ppsync-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.ppsync-box .ppsync-note{font-size:11.5px;color:var(--muted,#6d7d91);line-height:1.9;margin:10px 0 0}
.ppsync-box .ppsync-log{margin:12px 0 0;padding:0;list-style:none;font-size:11.5px;max-height:180px;overflow:auto;border-top:1px dashed var(--line,#dce5ef)}
.ppsync-box .ppsync-log li{padding:5px 2px;border-bottom:1px dashed var(--line,#dce5ef);display:flex;gap:8px;justify-content:space-between}
.ppsync-box .ppsync-log li small{color:var(--muted,#6d7d91);white-space:nowrap}
.ppsync-chip{display:inline-flex;align-items:center;gap:6px;padding:2px 9px;border-radius:999px;font-size:11px;line-height:1.9;cursor:pointer;border:1px solid transparent;background:transparent;color:inherit;font-family:inherit}
.ppsync-chip i{width:8px;height:8px;border-radius:50%;background:#9aa7b6;display:inline-block}
.ppsync-chip.ok i{background:#1f9d61}.ppsync-chip.warn i{background:#d99a38}.ppsync-chip.bad i{background:#d04848}.ppsync-chip.busy i{background:#2f6fd6;animation:ppsyncPulse 1s ease-in-out infinite}
@media (max-width: 760px){.ppsync-box .ppsync-grid{grid-template-columns:minmax(0,1fr)}.ppsync-box .ppsync-actions .btn{flex:1 1 140px;justify-content:center}}
html[data-theme="dark"] .ppsync-box .ppsync-state{background:rgba(255,255,255,.04);border-color:rgba(255,255,255,.1)}

.ppsync-box .ppsync-auto{display:flex;align-items:center;gap:10px;padding:10px 12px;border:1px solid var(--line,#dce5ef);border-radius:12px;cursor:pointer;align-self:end;min-height:44px;box-sizing:border-box}
.ppsync-box .ppsync-auto input{width:18px!important;height:18px;min-height:0!important;margin:0;flex:0 0 auto;accent-color:var(--acc,#1d3f8f)}
.ppsync-box .ppsync-auto span{display:flex;flex-direction:column;line-height:1.6}
.ppsync-box .ppsync-auto small{color:var(--muted,#6d7d91);font-size:10.5px}
/* نشانگر وضعیت همگام‌سازی در نوار بالا؛ در موبایل فقط یک نقطه کوچک */
.topbar .ppsync-chip{flex:0 0 auto;white-space:nowrap}
.topbar > .ppsync-chip{margin-inline-start:auto}
@media (max-width: 760px), (pointer: coarse) and (hover: none){
  html body #app .topbar{position:relative}
  html body #app .topbar > .ppsync-chip{position:absolute!important;top:3px;left:3px;margin:0!important;padding:5px!important;width:auto!important;height:auto;min-height:0!important;font-size:0!important;gap:0;border:0;background:transparent;z-index:3}
  html body #app .topbar > .ppsync-chip i{width:9px;height:9px;box-shadow:0 0 0 2px var(--panel,#fff)}
  /* [4] دکمه شناور موزیک در گوشی روی دکمه‌ها می‌افتاد: فقط آیکن */
  html body .pp-audio-toggle{padding:0!important;width:40px;height:40px;justify-content:center;border-radius:50%!important}
  html body .pp-audio-toggle .pp-audio-label{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
  /* [3] رفع بیرون‌زدگی نوار بالا در گوشی (از نسخه‌های قبل): دکمه جستجو ۳۳۰px ثابت بود و
     زنگ اعلان و دکمه پوسته بیرون از صفحه می‌افتادند و کل صفحه افقی جابه‌جا می‌شد. */
  html body #app .topbar .tb-r{min-width:0!important;max-width:100%!important;gap:6px}
  html body #app .topbar .tb-r .cmd{flex:1 1 auto!important;min-width:0!important;width:auto!important;max-width:none!important}
  html body #app .topbar .tb-r .cmd span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  html body #app .topbar .tb-r .cmd kbd{display:none!important}
  html body section.work{overflow-x:hidden}
}
