/* ==========================================================================
   POPUP ADMIN TENANT - disinkronkan dengan popup member area (.bl-modal)
   Hanya menyasar elemen POPUP. Tidak mengubah layout/tabel/form/data.

   PENTING (visibility): halaman admin sendiri yang membuka & menutup popup
   (inline style / kelas .active / :target / elemen dibuat saat dipanggil).
   File ini tidak memaksa display. JS hanya menandai "sedang terbuka" dengan
   kelas .ap-open, lalu semua styling member area berlaku pada kondisi itu.
   -> popup tidak akan pernah muncul sendiri, dan tidak akan pernah macet
      karena tertimpa CSS.

   Pola yang ditangani:
     A .modal > .modal-content            (menu1, menuONLINE)
     B .popup-billing-overlay             (info fitur terkunci)
     C .pg-modal-overlay                  (panduan profile)
     D .dev-modal                         (info profile)
     E .modal-window                      (help / hapus data, buka via :target)
     F .gacs-modal-bg                     (konfirmasi & detail perangkat)
     G .modal-overlay                     (telegram setting)
   Token --ap-* diisi dari include/headhtml.php sesuai tema tenant.
   ========================================================================== */

/* ---------- A. .modal > .modal-content ---------- */
html body .modal{display:none!important}
html body .modal.ap-open{
  display:flex!important;align-items:flex-start!important;justify-content:center!important;
  padding:16px!important;overflow-y:auto!important;-webkit-overflow-scrolling:touch;
  background:rgba(15,23,42,.55)!important;
  backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);z-index:10002!important;
}
html body .modal > .modal-content{
  position:relative;background:var(--ap-surf,#fff)!important;color:var(--ap-txt,#111)!important;
  border-radius:18px!important;max-width:520px!important;width:100%!important;
  padding:15px 17px!important;margin:auto!important;border:1px solid var(--ap-bord,#eef2f7);
  box-shadow:var(--ap-shadow-lg,0 12px 40px rgba(16,24,40,.18));overflow:hidden;
}
html body .modal > .modal-content > h3:first-of-type{
  margin:-15px -17px 14px!important;padding:15px 52px 15px 17px!important;
  background:linear-gradient(135deg,var(--ap-a,#008BC9),var(--ap-ad,#006f9e));
  color:#fff!important;border-radius:0;font-size:15px!important;font-weight:700;
}
html body .modal > .modal-content > .close{
  position:absolute!important;top:12px;right:14px;float:none;margin:0!important;
  width:30px;height:30px;line-height:1;font-size:14px;color:#fff;text-align:center;
  background:rgba(255,255,255,.18);border-radius:50%!important;display:inline-flex;
  align-items:center;justify-content:center;cursor:pointer;box-shadow:none!important;
}
html body .modal > .modal-content > .close:hover{background:rgba(255,255,255,.35);color:#fff}
html body .modal > .modal-content > p{margin:0 0 10px;line-height:1.55;font-size:13.5px}
html body .modal > .modal-content .social-footer{color:var(--ap-txt,#111);border-top:1px solid var(--ap-bord,#eef2f7);padding-top:12px;margin-top:12px;font-size:13px!important}
html body .modal > .modal-content .social-footer a{color:var(--ap-a,#008BC9)}

/* ---------- B. .popup-billing-overlay ---------- */
html body .popup-billing-overlay{display:none!important}
html body .popup-billing-overlay.ap-open{
  display:flex!important;align-items:flex-start!important;justify-content:center!important;
  padding:16px!important;overflow-y:auto!important;
  background:rgba(15,23,42,.55)!important;backdrop-filter:blur(2px);
  -webkit-backdrop-filter:blur(2px);z-index:10002!important;
}
html body .popup-billing-box{
  position:relative;background:var(--ap-surf,#fff)!important;color:var(--ap-txt,#111)!important;
  border-radius:18px!important;max-width:520px!important;width:100%!important;
  padding:15px 17px!important;border:1px solid var(--ap-bord,#eef2f7);
  box-shadow:var(--ap-shadow-lg,0 12px 40px rgba(16,24,40,.18));overflow:hidden;
}
html body .popup-billing-title{
  margin:-15px -17px 14px!important;padding:15px 52px 15px 17px!important;
  background:linear-gradient(135deg,var(--ap-a,#008BC9),var(--ap-ad,#006f9e));
  color:#fff!important;font-size:15px!important;font-weight:700;border-radius:0;
}
html body .popup-billing-box .btn-close-billing{
  position:absolute!important;top:12px;right:14px;width:30px;height:30px;padding:0;
  line-height:1;font-size:14px;color:#fff;background:rgba(255,255,255,.18);
  border:none;border-radius:50%!important;display:inline-flex;align-items:center;justify-content:center;
  cursor:pointer;box-shadow:none!important;min-height:0!important;margin:0!important;
}
html body .popup-billing-box .btn-close-billing:hover{background:rgba(255,255,255,.35);color:#fff}
html body .popup-billing-desc{color:var(--ap-txt,#111);line-height:1.55;font-size:13.5px}
html body .popup-billing-list{margin-top:12px;padding-top:12px;border-top:1px solid var(--ap-bord,#eef2f7);color:var(--ap-txt,#111);font-size:13px;line-height:1.7}

/* ---------- C. .pg-modal-overlay ---------- */
html body .pg-modal-overlay{display:none!important}
html body .pg-modal-overlay.ap-open{
  display:flex!important;align-items:flex-start!important;justify-content:center!important;
  padding:16px!important;overflow-y:auto!important;background:rgba(15,23,42,.55)!important;
  backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);z-index:10002!important;
}
html body .pg-modal-overlay > .pg-modal-content{
  position:relative;background:var(--ap-surf,#fff)!important;color:var(--ap-txt,#111)!important;
  border-radius:18px!important;max-width:640px!important;width:100%!important;padding:0!important;
  border:1px solid var(--ap-bord,#eef2f7);box-shadow:var(--ap-shadow-lg,0 12px 40px rgba(16,24,40,.18));
  overflow:hidden;margin:auto!important;
}
html body .pg-modal-content > .card-header{
  background:linear-gradient(135deg,var(--ap-a,#008BC9),var(--ap-ad,#006f9e))!important;
  color:#fff!important;margin:0!important;padding:15px 52px 15px 17px!important;
  border:0!important;border-radius:0!important;
}
html body .pg-modal-content > .card-header h3{margin:0;font-size:15px;color:#fff!important}
html body .pg-modal-content > .card-header h3 i{color:#fff!important}
html body .pg-modal-content > .card-header .btn-close{
  position:absolute!important;top:12px;right:14px;width:30px;height:30px;padding:0;margin:0!important;
  line-height:1;font-size:14px;color:#fff;background:rgba(255,255,255,.18)!important;
  border:none!important;border-radius:50%!important;display:inline-flex;align-items:center;justify-content:center;
  cursor:pointer;box-shadow:none!important;min-height:0!important;
}
html body .pg-modal-content > .card-header .btn-close:hover{background:rgba(255,255,255,.35)!important;color:#fff!important}
html body .pg-modal-content > .card-body{background:var(--ap-surf,#fff)!important;color:var(--ap-txt,#111)!important;padding:15px 17px!important}

/* ---------- D. .dev-modal ---------- */
html body .dev-modal{display:none!important;opacity:0!important;visibility:hidden!important}
html body .dev-modal.ap-open,
html body .dev-modal.active{
  display:flex!important;align-items:flex-start!important;justify-content:center!important;
  padding:16px!important;overflow-y:auto!important;background:rgba(15,23,42,.55)!important;
  backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);z-index:10002!important;
  opacity:1!important;visibility:visible!important;
}
html body .dev-modal > .dev-modal-card{
  position:relative;background:var(--ap-surf,#fff)!important;color:var(--ap-txt,#111)!important;
  border-radius:18px!important;width:100%!important;padding:15px 17px!important;
  border:1px solid var(--ap-bord,#eef2f7);box-shadow:var(--ap-shadow-lg,0 12px 40px rgba(16,24,40,.18));
  overflow:hidden;margin:auto!important;max-width:420px!important;transform:none!important;
}
html body .dev-modal-card > h4{
  margin:-15px -17px 14px!important;padding:15px 52px 15px 17px!important;
  background:linear-gradient(135deg,var(--ap-a,#008BC9),var(--ap-ad,#006f9e));
  color:#fff!important;font-size:15px!important;border-radius:0;
}
html body .dev-modal-card > h4 i{color:#fff!important}
html body .dev-modal-card > .close-modal{
  position:absolute!important;top:12px;right:14px;width:30px;height:30px;padding:0;margin:0;
  line-height:30px;text-align:center;font-size:14px;color:#fff;background:rgba(255,255,255,.18);
  border-radius:50%!important;cursor:pointer;box-shadow:none!important;min-height:0!important;
}
html body .dev-modal-card > .close-modal:hover{background:rgba(255,255,255,.35);color:#fff}
html body .dev-modal-card hr{border-color:var(--ap-bord,#eef2f7)!important;opacity:1}

/* ---------- E. .modal-window (dibuka lewat :target, visibility bawaan halaman) ---------- */
html body .modal-window{
  background:rgba(15,23,42,.55)!important;backdrop-filter:blur(2px);
  -webkit-backdrop-filter:blur(2px);overflow-y:auto!important;padding:16px;
}
html body .modal-window > div{
  width:100%!important;max-width:520px;margin:0 auto!important;position:relative;
  background:var(--ap-surf,#fff)!important;color:var(--ap-txt,#111)!important;
  border-radius:18px!important;border:1px solid var(--ap-bord,#eef2f7);
  box-shadow:var(--ap-shadow-lg,0 12px 40px rgba(16,24,40,.18));overflow:hidden;
  padding:15px 17px!important;line-height:1.6;
}
html body .modal-window > div > header{
  margin:-15px -17px 14px!important;
  background:linear-gradient(135deg,var(--ap-a,#008BC9),var(--ap-ad,#006f9e));
  color:#fff;padding:15px 52px 15px 17px;
}
html body .modal-window > div > header h1{margin:0;font-size:15px;color:#fff}
html body .modal-window > div > p{margin:0 0 10px;color:var(--ap-txt,#111)}
html body .modal-window > div > form,
html body .modal-window > div > div{color:var(--ap-txt,#111)}
html body .modal-window > div > form:last-child,
html body .modal-window > div > div:last-child{margin-bottom:0}
html body .modal-window .modal-close{
  position:absolute!important;top:12px;right:14px;width:30px!important;height:30px;line-height:30px;
  font-size:14px;text-align:center;color:#fff;background:rgba(255,255,255,.18);
  border-radius:50%!important;padding:0!important;box-shadow:none!important;min-height:0!important;margin:0!important;
}
html body .modal-window .modal-close:hover{background:rgba(255,255,255,.35);color:#fff}
html body .modal-window .btn.modal-close{
  position:static!important;display:inline-flex;align-items:center;justify-content:center;
  width:auto!important;min-width:104px;min-height:44px;margin:5px;padding:11px 18px;
  background:var(--ap-surf,#fff)!important;color:var(--ap-txt,#111)!important;
  border:1px solid var(--ap-bord,#ddd)!important;border-radius:999px!important;font-weight:700;
}

/* ---------- F. .gacs-modal-bg (elemen hanya ada saat popup dipanggil) ---------- */
html body .gacs-modal-bg{
  align-items:flex-start!important;padding:16px!important;overflow-y:auto!important;
  background:rgba(15,23,42,.55)!important;backdrop-filter:blur(2px);
  -webkit-backdrop-filter:blur(2px);
}
html body .gacs-modal{
  background:var(--ap-surf,#fff)!important;border-radius:18px!important;
  box-shadow:var(--ap-shadow-lg,0 12px 40px rgba(16,24,40,.18))!important;
}
html body .gacs-modal-h{
  position:relative;padding:15px 52px 15px 17px!important;color:#fff;
  background:linear-gradient(135deg,var(--ap-a,#008BC9),var(--ap-ad,#006f9e))!important;
}
html body .gacs-modal-h h4{margin:0;font-size:15px}
html body .gacs-modal-b{background:var(--ap-surf,#fff)!important;color:var(--ap-txt,#111)!important}
html body .gacs-modal-f{background:var(--ap-surf2,#f8fafc)!important;border-top-color:var(--ap-bord,#eef2f7)!important;gap:9px}
html body .gacs-modal-f button{
  flex:1 1 140px;border-radius:10px!important;padding:11px 14px!important;
  min-height:44px;font-weight:700;font-size:13.5px;border:none;
}
html body .gacs-btn-close{background:var(--ap-surf,#fff)!important;border:1px solid var(--ap-bord,#ddd)!important;color:var(--ap-mut,#555)!important}
html body .gacs-btn-go{background:linear-gradient(135deg,var(--ap-ad,#006f9e),var(--ap-add,#046a99))!important;color:#fff!important}
html body .gacs-modal .ap-x{
  position:absolute;top:12px;right:14px;width:30px;height:30px;border:none;
  border-radius:50%!important;background:rgba(255,255,255,.18);color:#fff;font-size:14px;line-height:1;
  cursor:pointer;padding:0;display:inline-flex;align-items:center;justify-content:center;box-shadow:none!important;min-height:0!important;
}
html body .gacs-modal .ap-x:hover{background:rgba(255,255,255,.35)}

/* ---------- G. .modal-overlay (telegram, dibuka lewat kelas .active) ---------- */
html body .modal-overlay{
  align-items:flex-start!important;padding:16px!important;overflow-y:auto!important;
  background:rgba(15,23,42,.55)!important;backdrop-filter:blur(2px);
  -webkit-backdrop-filter:blur(2px);
}
html body .modal-overlay > .modal-box{
  position:relative;background:var(--ap-surf,#fff)!important;color:var(--ap-txt,#111)!important;
  border-radius:18px!important;max-width:440px!important;width:100%!important;padding:0!important;
  border:1px solid var(--ap-bord,#eef2f7);box-shadow:var(--ap-shadow-lg,0 12px 40px rgba(16,24,40,.18));
  overflow:hidden;margin:auto!important;
}
html body .modal-box > .modal-header{
  background:linear-gradient(135deg,var(--ap-a,#008BC9),var(--ap-ad,#006f9e));
  color:#fff;margin:0;padding:15px 52px 15px 17px;border:0;
}
html body .modal-box > .modal-header h3{margin:0;font-size:15px;color:#fff}
html body .modal-box > .modal-body{padding:15px 17px;background:var(--ap-surf,#fff);color:var(--ap-txt,#111)}
html body .modal-box .modal-close{
  position:absolute!important;top:12px;right:14px;width:30px;height:30px;padding:0;
  line-height:1;font-size:14px;color:#fff;background:rgba(255,255,255,.18);border:none;
  border-radius:50%!important;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;
  box-shadow:none!important;min-height:0!important;margin:0!important;
}
html body .modal-box .modal-close:hover{background:rgba(255,255,255,.35);color:#fff}

/* ---------- tombol aksi di dalam popup: pill + min 44px (rasa sama member area) ---------- */
html body .modal-content button:not(.close):not(.ap-x),
html body .popup-billing-box button:not(.btn-close-billing):not(.ap-x),
html body .pg-modal-content button:not(.btn-close):not(.ap-x),
html body .dev-modal-card button:not(.close-modal):not(.ap-x),
html body .modal-window button:not(.modal-close):not(.ap-x),
html body .gacs-modal button:not(.ap-x):not(.gacs-btn-close),
html body .modal-box button:not(.modal-close):not(.ap-x){
  min-height:44px;border-radius:999px!important;font-weight:700;padding:11px 18px;
  display:inline-flex;align-items:center;justify-content:center;gap:8px;cursor:pointer;
}
html body .gacs-modal-f button{border-radius:10px!important}

/* ---------- border-box: popup tidak meluber di layar 320px ---------- */
html body .modal, html body .popup-billing-overlay, html body .pg-modal-overlay,
html body .dev-modal, html body .gacs-modal-bg, html body .modal-overlay,
html body .modal-window, html body .modal-content, html body .popup-billing-box,
html body .pg-modal-content, html body .dev-modal-card, html body .modal-window>div,
html body .gacs-modal, html body .modal-box,
html body .modal-content *, html body .popup-billing-box *, html body .pg-modal-content *,
html body .dev-modal-card *, html body .modal-window>div *, html body .gacs-modal *,
html body .modal-box *{box-sizing:border-box}
html body .modal-content, html body .popup-billing-box, html body .pg-modal-content,
html body .dev-modal-card, html body .modal-window>div, html body .gacs-modal,
html body .modal-box{max-width:100%!important}

/* ---------- kunci scroll saat popup terbuka (dikelola admin-popup.js) ---------- */
body.ap-popup-open{overflow:hidden}
@media (max-width:750px){
  html body .modal-window>div{max-width:100%}
}