/* النافذة P — صفحة الشحن (2026-11-27): بطاقات مربّعة + نافذة المبلغ + مجموعات البنوك.
   ألوان الثيم فقط (var(--…)) — الثيمات الثلاثة وRTL/LTR والهاتف. بلا تدرّجات. --g = لون نوع البوّابة. */

.pl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── الشبكة ── */
.pl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; border: 0; padding: 0; margin: 0; min-width: 0; }

.pl-gw {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
    gap: 4px; padding: 20px 14px 18px; min-height: 196px; min-width: 0;
    border: 2px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text);
    cursor: pointer; overflow: hidden; transition: transform .2s, border-color .2s, box-shadow .2s;
}
.pl-gw::before {
    content: ''; position: absolute; top: 0; inset-inline: 0; height: 4px; background: var(--g, var(--primary));
    transform: scaleX(0); transition: transform .25s;
}
.pl-gw:hover { transform: translateY(-3px); border-color: var(--g, var(--primary)); box-shadow: 0 14px 30px rgba(15, 23, 42, .10); }
.pl-gw:hover::before, .pl-gw:has(input:checked)::before { transform: scaleX(1); }
.pl-gw:has(input:checked) { border-color: var(--g, var(--primary)); }
.pl-gw:focus-within { box-shadow: 0 0 0 3px var(--primary-soft); }
.pl-gw input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }

/* الشعار (2026-11-29): صندوق عريض — شعارات البوّابات والبنوك أعرض من طولها */
.pl-logo {
    position: relative; flex: none; width: 100%; max-width: 156px; height: 68px; margin: 0 auto 10px; padding: 8px 12px; border-radius: 14px;
    background: #fff; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .12); transition: transform .25s; color: var(--g, var(--primary));
}
.pl-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pl-logo > .mx-i { display: none; width: 34px; height: 34px; }
.pl-logo.no-img img { display: none; }
.pl-logo.no-img > .mx-i { display: inline-block; }
.pl-gw:hover .pl-logo { transform: scale(1.04); }
/* علم المجموعة (البنوك المغربية) على ركن الشعار */
.pl-flag { position: absolute; bottom: -6px; inset-inline-end: -6px; display: block; width: 28px; height: 19px; border-radius: 4px; overflow: hidden;
    box-shadow: 0 2px 6px rgba(15, 23, 42, .25); border: 2px solid var(--surface); line-height: 0; }
.pl-flag svg { width: 100%; height: 100%; display: block; }
.pl-gw-cnt { font-size: .74rem; font-weight: 700; color: var(--text-dim); }

/* عنوان القسم (بدل رأس «المحفظة» وبطاقة الرصيد) */
.pl-dep-h { margin: 0 0 14px; }
.pl-dep-h h1 { margin: 0 0 4px; font-size: 1.35rem; font-weight: 900; color: var(--text); }
.pl-dep-h p { margin: 0; font-size: .86rem; color: var(--text-dim); }
/* سطر المحجوز + المستوى تحت البوّابات */
.pl-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 16px 0 0; padding-top: 12px; border-top: 1px dashed var(--border); font-size: .84rem; color: var(--text-dim); }
.pl-meta-i { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); text-decoration: none; }
.pl-meta-i b { color: var(--text); }
.pl-meta-i .mx-i { width: 16px; height: 16px; }
a.pl-meta-i:hover b { color: var(--primary); }

.pl-gw-name { font-weight: 800; font-size: .98rem; line-height: 1.35; color: var(--text); overflow-wrap: anywhere; }
.pl-gw-type { font-size: .7rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.pl-gw-range { font-size: .74rem; color: var(--text-dim); }
.pl-gw-tick {
    position: absolute; top: 10px; inset-inline-end: 10px; width: 24px; height: 24px; border-radius: 50%;
    background: var(--g, var(--primary)); color: #fff; display: none; align-items: center; justify-content: center;
}
.pl-gw-tick .mx-i { width: 14px; height: 14px; }
/* §P4: شارة البونص */
.pl-gw-bonus {
    position: absolute; top: 10px; inset-inline-start: 10px; max-width: calc(100% - 46px);
    padding: 3px 8px; border-radius: 999px; background: var(--ok); color: #fff;
    font-size: .68rem; font-weight: 800; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pl-gw:has(input:checked) .pl-gw-tick { display: flex; }

/* ── المجموعة (details.mx-gwg) ── */
.pl-grp { min-width: 0; }
.pl-grp:not([open]) { grid-column: auto; }                 /* mx.css يمدّ .mx-gwg على الصفّ كلّه — مغلقة = بطاقة */
.pl-grp > summary.pl-gw { display: flex; list-style: none; height: 100%; }
.pl-grp > summary::-webkit-details-marker { display: none; }
.pl-grp.has-checked > summary { border-color: var(--g, var(--primary)); }
.pl-gw-caret { position: absolute; top: 12px; inset-inline-end: 12px; color: var(--text-dim); transition: transform .2s; }
.pl-grp[open] .pl-gw-caret { transform: rotate(180deg); }
.pl-grp:not([open]) > summary .pl-gw-caret { display: none; }   /* مغلقة: «3 خيارات» تكفي، والسهم كان يغطّي ركن الشعار */
.pl-stack { display: flex; justify-content: center; margin-bottom: 8px; }
.pl-stack .pl-logo { width: 52px; height: 52px; padding: 7px; margin: 0; border: 2px solid var(--surface); }
.pl-stack .pl-logo + .pl-logo { margin-inline-start: -16px; }
.pl-stack .pl-logo > .mx-i { width: 24px; height: 24px; }

.pl-grp[open] { grid-column: 1 / -1; border-radius: 20px; background: var(--surface-2); padding: 10px; }
.pl-grp[open] > summary {
    flex-direction: row; flex-wrap: wrap; justify-content: flex-start; text-align: start; min-height: 0; height: auto;
    gap: 6px 12px; padding: 12px 52px 12px 14px; border-color: var(--g, var(--primary));
}
[dir="rtl"] .pl-grp[open] > summary { padding: 12px 14px 12px 52px; }
.pl-grp[open] > summary .pl-logo, .pl-grp[open] > summary .pl-stack { margin: 0; }
.pl-grp[open] > summary .pl-logo { width: 96px; height: 44px; padding: 5px 8px; }
.pl-grp[open] > summary .pl-gw-name { font-size: 1.05rem; }
.pl-grp-list { padding: 12px 4px 4px; }
.pl-grp-pick { display: block; font-size: .85rem; color: var(--text-dim); margin-bottom: 10px; }
.pl-grp-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.pl-gw-sub { min-height: 168px; }

/* ── لوحة المبلغ: بلا JS لوحة عادية؛ مع JS نافذة ── */
.pl-pay { margin-top: 18px; }
.pl-sheet { position: relative; max-width: 520px; margin: 0 auto; padding: 22px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); }
.pl-x {
    position: absolute; top: 12px; inset-inline-end: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0;
    background: var(--surface-2); color: var(--text-dim); cursor: pointer; display: none; align-items: center; justify-content: center;
}
.pl-x:hover { color: var(--danger); }
.pl-sheet-h { text-align: center; margin-bottom: 14px; }
.pl-logo-lg { width: 190px; max-width: 70%; height: 76px; margin: 0 auto 10px; }
.pl-sheet-h h3 { margin: 0 0 4px; font-size: 1.3rem; font-weight: 900; color: var(--text); overflow-wrap: anywhere; }
.pl-sheet-h p { margin: 0; color: var(--text-dim); font-size: .86rem; }

/* مع JS: اللوحة تُنقل لآخر body (خارج .mx المعزولة) فتعلو الهيدر الثابت (z 50) */
.pl-pay [hidden] { display: none !important; }
.pl-pay.pl-modal {
    display: none; position: fixed; inset: 0; z-index: 2000; margin: 0; padding: 16px;
    background: rgba(3, 6, 23, .72); align-items: center; justify-content: center;
}
.pl-pay.pl-modal.is-open { display: flex; }
.pl-modal .pl-sheet { width: 100%; max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.pl-modal .pl-x { display: flex; }
html.pl-lock { overflow: hidden; }

/* مبدّل بنوك المجموعة داخل النافذة */
.pl-sw { margin: 0 0 12px; }
.pl-sw-k { display: block; font-size: .8rem; font-weight: 700; color: var(--text-dim); margin-bottom: 6px; }
.pl-sw-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pl-sw-b {
    display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border: 1.5px solid var(--border); border-radius: 12px;
    background: var(--bg); color: var(--text); cursor: pointer; white-space: nowrap; font: inherit; font-weight: 700; font-size: .85rem;
}
[dir="rtl"] .pl-sw-b { padding: 6px 6px 6px 12px; }
.pl-sw-b.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.pl-logo-sm, .pl-sw-b .pl-logo { width: 58px; height: 30px; padding: 3px 6px; border-radius: 8px; margin: 0; box-shadow: none; border: 1px solid var(--border); }
.pl-logo-sm > .mx-i, .pl-sw-b .pl-logo > .mx-i { width: 18px; height: 18px; }
.pl-sw-b .pl-flag, .pl-logo-sm .pl-flag { display: none; }

/* نافذة المجموعة المنبثقة: كل بنك/وكالة بشعاره */
.pl-gmodal .pl-sheet { max-width: 600px; }
.pl-glist { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.pl-gopt {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0;
    padding: 16px 10px 14px; border: 2px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text);
    font: inherit; cursor: pointer; text-align: center; transition: border-color .2s, transform .2s;
}
.pl-gopt:hover, .pl-gopt:focus-visible { border-color: var(--primary); transform: translateY(-2px); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.pl-gopt.on { border-color: var(--primary); }
.pl-gopt .pl-logo { height: 56px; margin-bottom: 8px; }
.pl-gopt .pl-gw-bonus { top: 8px; inset-inline-start: 8px; }

/* معلومات الحساب (يدوية) — تتبدّل بالبنك المختار */
.pl-info { margin: 0 0 14px; padding: 4px 12px 12px; border-radius: 14px; background: var(--surface-2); }
.pl-info .mx-acct { margin: 8px 0 10px; }
.pl-instr { font-size: .88rem; }
.pl-qr { max-width: 180px; }

.pl-amt .mx-in { font-size: 1.6rem; font-weight: 900; text-align: center; }
.pl-note { margin: -6px 0 14px; }
.pl-submit { width: 100%; }
.pl-hist { margin-top: 18px; }

@media (max-width: 720px) {
    .pl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .pl-gw { min-height: 164px; padding: 16px 10px 14px; border-radius: 16px; }
    .pl-logo { height: 54px; padding: 6px 8px; border-radius: 12px; }
    .pl-logo > .mx-i { width: 28px; height: 28px; }
    .pl-glist { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .pl-gopt .pl-logo { height: 48px; }
    .pl-dep-h h1 { font-size: 1.15rem; }
    .pl-gw-name { font-size: .9rem; }
    .pl-grp-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .pl-pay.pl-modal { align-items: flex-end; padding: 0; }
    .pl-modal .pl-sheet { max-width: none; border-radius: 20px 20px 0 0; max-height: 92vh; padding: 18px 16px 22px; }
}

/* ── لوحة الأدمن /admin/pay-groups ── */
.pl-adm-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.pl-adm-logo { width: 32px; height: 32px; object-fit: contain; border-radius: 8px; background: #fff; border: 1px solid var(--border); }
/* رفع الشعار (البوّابة والمجموعة) */
.pl-logo-now { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 0 0 12px; }
.pl-logo-prev { display: flex; align-items: center; justify-content: center; width: 160px; height: 64px; padding: 6px 10px;
    border-radius: 12px; background: #fff; border: 1px solid var(--border); }
.pl-logo-prev img { width: 100%; height: 100%; object-fit: contain; }
.pl-logo-rm { margin-top: 8px; }
