/* Completed top-ups use a statement layout; the ongoing payment flow is unchanged. */
#portalModal .portal-dialog:has(.ph-invoice){box-sizing:border-box;width:min(1040px,calc(100vw - 32px));max-width:1040px;padding:24px;background:#f3f5f8;border-radius:22px;max-height:92dvh}
#paymentBillView:has(.ph-invoice) .ph-bill-toolbar{padding:4px 42px 18px 0}
#paymentBillView:has(.ph-invoice) .ph-bill-toolbar h2{font-size:19px}
#paymentBillView:has(.ph-invoice) .ph-bill-toolbar button{padding:10px 15px;font-size:13px;border-radius:10px;background:#3568d9;color:#fff}
#paymentBill.ph-invoice{--pi-text:#253243;--pi-muted:#6d7b8d;--pi-soft:#f6f7f9;--pi-line:#e4e8ed;--pi-green:#397f5a;background:#fff;color:var(--pi-text);border:1px solid #dfe4eb;border-radius:14px;padding:40px 44px;box-shadow:0 3px 12px #1d35530a;overflow:visible;font-size:14px;line-height:1.65}
.ph-invoice-head{display:flex;align-items:flex-start;justify-content:space-between;gap:24px;margin-bottom:30px}
.ph-invoice-brand{display:flex;align-items:center;gap:12px;min-width:0}
.ph-invoice-brand>img{display:block;width:60px;height:52px;object-fit:contain;flex:none}
.ph-invoice-brand>div{display:grid;gap:3px;min-width:0}
.ph-invoice-brand strong{font-size:20px;letter-spacing:-.4px;color:#273c59;line-height:1.4}
.ph-invoice-brand>div>span{font-size:12px;color:var(--pi-muted)}
#paymentBill .ph-invoice-head .ph-status{font-size:13px;font-weight:650;padding:7px 13px;border-radius:6px;line-height:1.5;gap:7px;display:inline-flex;align-items:center;flex:none}
#paymentBill .ph-invoice-head .ph-status.ph-credited{background:#438961;color:#fff}
#paymentBill .ph-invoice-head .ph-status svg{width:15px;height:15px;flex:none}
.ph-invoice h3{font-size:11px;line-height:1.5;text-transform:uppercase;letter-spacing:.7px;color:var(--pi-muted);font-weight:600;margin:0 0 9px}
.ph-invoice-overview{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:24px;padding-bottom:27px;border-bottom:1px solid var(--pi-line)}
.ph-invoice-overview>div{min-width:0}
.ph-invoice-id{font-size:14px;overflow-wrap:anywhere;font-weight:600;line-height:1.5;display:block}
.ph-invoice-overview p{margin:8px 0 0;font-size:12px;color:var(--pi-muted)}
.ph-invoice-overview p>span:first-child{margin-right:4px}
.ph-invoice-paid{text-align:right;align-self:start}
.ph-invoice-paid>strong{display:block;font-size:28px;line-height:1.3;letter-spacing:-.5px;color:var(--pi-green);font-weight:650;white-space:nowrap;font-variant-numeric:tabular-nums}
.ph-invoice-billed{padding:28px 0 30px}
.ph-invoice-customer{display:flex;align-items:flex-start;gap:13px;min-width:0}
.ph-invoice-avatar{display:grid;place-items:center;flex:none;width:42px;height:42px;background:var(--pi-soft);border:1px solid var(--pi-line);border-radius:50%;font-size:16px;color:var(--pi-muted)}
.ph-invoice-customer>div{min-width:0}
.ph-invoice-customer strong{font-size:16px;font-weight:650;overflow-wrap:anywhere}
.ph-invoice-customer p{margin:4px 0 0;color:var(--pi-muted);font-size:13px;overflow-wrap:anywhere}
.ph-invoice-items{border-top:1px solid var(--pi-line);padding-top:8px}
.ph-invoice-lines{border:0;border-collapse:collapse;width:100%;min-width:0;background:transparent;font:inherit;table-layout:fixed}
.ph-invoice-lines th{font-size:11px;letter-spacing:.5px;line-height:1.5;color:var(--pi-muted);text-align:left;font-weight:600;background:transparent;padding:13px 0;border-bottom:1px solid var(--pi-line)}
.ph-invoice-lines td{padding:17px 0;font-size:14px;background:transparent;color:var(--pi-text);border:0;border-bottom:1px solid var(--pi-line);vertical-align:top;overflow-wrap:anywhere}
.ph-invoice-lines th:first-child,.ph-invoice-lines td:first-child{width:55px}
.ph-invoice-lines th:last-child,.ph-invoice-lines td:last-child{text-align:right;width:175px;font-variant-numeric:tabular-nums}
.ph-invoice-lines td:nth-child(2){font-weight:600;padding-right:16px}
#paymentBill .ph-invoice-totals{width:min(330px,100%);margin:16px 0 26px auto}
#paymentBill .ph-invoice-totals>div{display:flex;align-items:baseline;justify-content:space-between;gap:18px;padding:10px 0}
#paymentBill .ph-invoice-totals dt{font-size:13px;color:var(--pi-muted)}
#paymentBill .ph-invoice-totals dd{margin:0;text-align:right;white-space:nowrap;font-size:14px;font-variant-numeric:tabular-nums}
#paymentBill .ph-invoice-totals>div:last-child{border-top:1px solid #a9b4c2;padding-top:13px;font-weight:650}
#paymentBill .ph-invoice-totals>div:last-child :is(dt,dd){font-size:15px;color:var(--pi-text)}
.ph-invoice-gateway{padding:20px 22px;background:var(--pi-soft);border:1px solid var(--pi-line);border-radius:7px}
.ph-invoice-gateway h3{margin-bottom:12px}
.ph-invoice-gateway dl{margin:0;display:grid;gap:9px}
.ph-invoice-gateway dl>div{display:grid;grid-template-columns:minmax(135px,.7fr) minmax(0,1.3fr);gap:14px;align-items:baseline}
.ph-invoice-gateway dt{color:var(--pi-muted);font-size:12px;line-height:1.7}
.ph-invoice-gateway dd{margin:0;text-align:right;font-size:13px;line-height:1.7;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
.ph-invoice-gateway dd span{overflow-wrap:anywhere}
#paymentBill.ph-invoice>.ph-invoice-footer{border-top:1px solid var(--pi-line);background:transparent;text-align:left;padding:21px 0 0;margin-top:26px;color:var(--pi-muted);font-size:11px;line-height:1.8}
.ph-invoice-footer>.ph-invoice-settled{font-size:13px;color:var(--pi-text);margin:0 0 8px}
.ph-invoice-footer>div{display:flex;justify-content:space-between;flex-wrap:wrap;gap:5px 18px}
html[data-theme=dark] #portalModal .portal-dialog:has(.ph-invoice){background:#111b2a}
html[data-theme=dark] #paymentBill.ph-invoice{--pi-text:#e1e9f4;--pi-muted:#a6b6cb;--pi-soft:#1b2b40;--pi-line:#33445b;--pi-green:#88cda9;background:#172437;border-color:#33445b;box-shadow:none}
html[data-theme=dark] .ph-invoice-brand strong{color:#e1eafb}
@media(max-width:700px){
 #portalModal .portal-dialog:has(.ph-invoice){width:calc(100vw - 16px);padding:17px 12px;max-height:93dvh;border-radius:18px}
 #paymentBillView:has(.ph-invoice) .ph-bill-toolbar{padding:21px 0 15px;gap:10px}
 #paymentBillView:has(.ph-invoice) .ph-bill-toolbar h2{font-size:17px}
 #paymentBillView:has(.ph-invoice) .ph-bill-toolbar button{font-size:11px;padding:9px 11px}
 #paymentBill.ph-invoice{padding:22px 18px;border-radius:11px;font-size:13px}
 .ph-invoice-head{gap:14px;margin-bottom:24px}
 .ph-invoice-brand{gap:8px;align-items:flex-start}
 .ph-invoice-brand>img{width:40px;height:36px}
 .ph-invoice-brand strong{font-size:16px;letter-spacing:-.3px}
 .ph-invoice-brand>div>span{font-size:10px}
 #paymentBill .ph-invoice-head .ph-status{font-size:11px;padding:6px 9px;gap:4px}
 #paymentBill .ph-invoice-head .ph-status svg{width:12px;height:12px}
 .ph-invoice-overview{grid-template-columns:minmax(0,1fr);gap:18px;padding-bottom:22px}
 .ph-invoice-id{font-size:12px}
 .ph-invoice-overview p{font-size:11px}
 .ph-invoice-paid{text-align:left}
 .ph-invoice-paid>strong{font-size:26px}
 .ph-invoice h3{font-size:10px}
 .ph-invoice-billed{padding:23px 0}
 .ph-invoice-customer strong{font-size:15px}
 .ph-invoice-customer p{font-size:12px}
 .ph-invoice-avatar{width:34px;height:34px;font-size:14px}
 .ph-invoice-lines th{font-size:10px;padding:11px 0}
 .ph-invoice-lines td{font-size:12px;padding:14px 0}
 .ph-invoice-lines th:first-child,.ph-invoice-lines td:first-child{width:32px}
 .ph-invoice-lines th:last-child,.ph-invoice-lines td:last-child{width:103px}
 .ph-invoice-lines td:nth-child(2){padding-right:8px}
 #paymentBill .ph-invoice-totals{margin:13px 0 22px auto;width:100%}
 #paymentBill .ph-invoice-totals dt,#paymentBill .ph-invoice-totals dd{font-size:12px}
 #paymentBill .ph-invoice-totals>div:last-child :is(dt,dd){font-size:13px}
 .ph-invoice-gateway{padding:17px 14px}
 .ph-invoice-gateway dl{gap:13px}
 .ph-invoice-gateway dl>div{grid-template-columns:minmax(0,1fr);gap:3px}
 .ph-invoice-gateway dt{font-size:11px}
 .ph-invoice-gateway dd{text-align:left;font-size:12px}
 #paymentBill.ph-invoice>.ph-invoice-footer{margin-top:22px;padding-top:17px;font-size:10px}
 .ph-invoice-footer>.ph-invoice-settled{font-size:12px}
}
@media(max-width:360px){.ph-invoice-brand>img{display:none}.ph-invoice-brand strong{font-size:15px}.ph-invoice-head{gap:8px}}
@media print{
 #paymentBill.ph-invoice{border:0;border-radius:0;box-shadow:none;padding:20px 24px;background:#fff!important;--pi-text:#172033;--pi-muted:#576578;--pi-soft:#f5f6f8;--pi-line:#dce2ea}
 .ph-invoice-gateway,.ph-invoice-items,.ph-invoice-billed,.ph-invoice-overview{break-inside:avoid}
 #paymentBill .ph-invoice-head .ph-status.ph-credited{background:#438961!important;color:white!important;print-color-adjust:exact}
 .ph-invoice-gateway{print-color-adjust:exact;background:#f5f6f8!important}
}

#paymentBill .ph-invoice-head .ph-status{border-radius:6px!important}
