
/* ==========================================================================
   Mark as Paid / Undo Mark as Paid panels
   Shared by the invoice modals and the offline (cash) payment page.
   Everything is scoped under .hp-mapx so it cannot leak into the theme.
   ========================================================================== */

.hp-mapx {
    --navy-900: #1B2559;
    --indigo-700: #32419C;
    --indigo-600: #3D4EC0;
    --indigo-500: #4C5EDD;
    --indigo-100: #E9EDFC;
    --indigo-50: #F4F6FE;
    --green-700: #0E8A4F;
    --green-600: #12A15E;
    --green-500: #16B267;
    --green-50: #E9F8F0;
    --amber-700: #9A6B1F;
    --amber-50: #FBF3E2;
    --red-600: #C0392B;
    --red-50: #FBEDEA;
    --card: #FFFFFF;
    --card-sub: #F7F8FD;
    --line: #E6E9F4;
    --line-strong: #CBD1E8;
    --ink: #232A4D;
    --ink-soft: #5A6187;
    --ink-faint: #8E94B8;
    --r-card: 16px;
    --r-pill: 999px;
    --shadow-lift: 0 6px 18px rgba(27, 37, 89, .10);
    --glow-indigo: 0 0 0 4px rgba(76, 94, 221, .13);
    --focus-ring: 0 0 0 3px rgba(76, 94, 221, .35);

    /* Typography stays the app's own — only colours and layout come from the design. */
    color: var(--ink);
}

.hp-mapx * { box-sizing: border-box; }

/* ---------- Head / body / foot ---------- */
.hp-mapx .panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 26px 30px 20px;
}
.hp-mapx .panel-head h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: var(--navy-900);
    letter-spacing: -.02em;
}
.hp-mapx .panel-head .context {
    margin: 4px 0 0;
    font-size: 13.5px;
    color: var(--ink-soft);
}
.hp-mapx .icon-btn {
    appearance: none;
    border: 0;
    background: var(--card-sub);
    color: var(--ink-soft);
    width: 34px;
    height: 34px;
    border-radius: var(--r-pill);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    flex: none;
    transition: background .15s ease, color .15s ease;
}
.hp-mapx .icon-btn:hover { background: var(--indigo-100); color: var(--indigo-700); }

.hp-mapx .panel-body {
    padding: 4px 30px 26px;
    display: flex;
    flex-direction: column;
    gap: 26px;
    max-height: 62vh;
    overflow-y: auto;
}

.hp-mapx .section-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 0 0 12px;
}

.hp-mapx .panel-foot {
    display: flex;
    gap: 12px;
    padding: 20px 30px 26px;
    border-top: 1px solid var(--line);
}

/* ---------- Customer summary ---------- */
.hp-mapx .customer-card {
    background: linear-gradient(160deg, var(--indigo-50), var(--card-sub));
    border: 1px solid var(--line);
    border-radius: var(--r-card);
    padding: 18px 20px;
}
.hp-mapx .customer-row {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}
.hp-mapx .avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--r-pill);
    background: linear-gradient(135deg, var(--indigo-500), var(--indigo-700));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 19px;
    flex: none;
    box-shadow: 0 4px 12px rgba(61, 78, 192, .28);
}
.hp-mapx .avatar.sm { width: 38px; height: 38px; font-size: 14px; box-shadow: none; }
.hp-mapx .customer-id { flex: 1 1 160px; min-width: 0; }
.hp-mapx .customer-id .name { font-weight: 700; font-size: 16px; color: var(--navy-900); }
.hp-mapx .amount-due { text-align: right; flex: none; }
.hp-mapx .amount-due .lbl {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-faint);
}
.hp-mapx .amount-due .amt {
    font-size: 27px;
    font-weight: 800;
    color: var(--navy-900);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.02em;
    line-height: 1.2;
}

.hp-mapx .chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.hp-mapx .chip {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: var(--r-pill);
    background: var(--card);
    border: 1px solid var(--line-strong);
    color: var(--ink-soft);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.hp-mapx .chip.group {
    background: linear-gradient(135deg, var(--indigo-100), #DDE3FB);
    border-color: transparent;
    color: var(--indigo-700);
}
.hp-mapx .chip.plan { background: var(--amber-50); border-color: transparent; color: var(--amber-700); }
.hp-mapx button.chip-action { cursor: pointer; color: var(--indigo-600); border-color: var(--indigo-600); }
.hp-mapx button.chip-action:hover { background: var(--indigo-50); }

/* Sections the offline payment page still renders in the old markup. */
.hp-mapx label.fs-18 {
    font-size: 11px !important;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-faint) !important;
}
.hp-mapx label.fs-18 + hr { border-top-color: var(--line); margin-top: 8px; }

/* Offline flow: the legacy gateway picker is replaced by the method cards above,
   but its wrapper still holds the totals, terms and submit block. */
.hp-mapx .hp-legacy-gateways > .mb-4,
.hp-mapx .hp-legacy-gateways > .mb-4 + div { display: none; }
.hp-mapx .chip.paid { background: var(--green-50); border-color: transparent; color: var(--green-700); }

/* ---------- Multi-customer list ---------- */
.hp-mapx .b-list { max-height: 240px; overflow-y: auto; }
.hp-mapx .b-row {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 11px 2px;
    border-bottom: 1px dashed var(--line-strong);
}
.hp-mapx .b-row:last-of-type { border-bottom: 0; }
.hp-mapx .b-main { flex: 1; min-width: 0; }
.hp-mapx .b-name { font-weight: 700; font-size: 14px; color: var(--navy-900); }
.hp-mapx .b-amt {
    font-weight: 700;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
    color: var(--navy-900);
    flex: none;
}
.hp-mapx .b-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding-top: 16px;
    border-top: 1px solid var(--line-strong);
}
.hp-mapx .b-total .lbl {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--ink-faint);
}
.hp-mapx .b-total .amt {
    font-size: 24px;
    font-weight: 800;
    color: var(--navy-900);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.02em;
}

/* ---------- Payer fields ---------- */
.hp-mapx .payer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hp-mapx .payer-hint { margin: 10px 0 0; font-size: 12px; color: var(--ink-faint); }
.hp-mapx .field { display: flex; flex-direction: column; gap: 5px; }
.hp-mapx .field.wide { grid-column: 1 / -1; }
.hp-mapx .field label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin: 0; }
.hp-mapx .field input {
    font: inherit;
    font-size: 14px;
    color: var(--ink);
    background: var(--card);
    border: 1.5px solid var(--line-strong);
    border-radius: 12px;
    padding: 10px 14px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.hp-mapx .field input::placeholder { color: var(--ink-faint); }
.hp-mapx .field input:focus {
    outline: none;
    border-color: var(--indigo-600);
    box-shadow: var(--glow-indigo);
}
.hp-mapx .field-error { font-size: 12px; color: var(--red-600); }

/* ---------- Choice cards ---------- */
.hp-mapx .method-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hp-mapx .choice-list { display: grid; gap: 12px; }
.hp-mapx .method-card { position: relative; margin: 0; }

.hp-mapx button.method-card {
    appearance: none;
    -webkit-appearance: none;
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    width: 100%;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
}
.hp-mapx button.method-card:focus-visible .body {
    outline: none;
    box-shadow: var(--focus-ring);
}
.hp-mapx .method-card input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 1;
}
.hp-mapx .method-card .body {
    border: 1.5px solid var(--line);
    border-radius: var(--r-card);
    padding: 18px;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 9px;
    background: var(--card);
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.hp-mapx .method-card:hover .body { border-color: var(--line-strong); box-shadow: var(--shadow-lift); }
.hp-mapx .method-card input:checked + .body {
    border-color: var(--indigo-600);
    background: var(--indigo-50);
    box-shadow: var(--glow-indigo);
}
.hp-mapx .method-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hp-mapx .method-glyph {
    width: 40px;
    height: 40px;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--indigo-100), #DDE3FB);
    color: var(--indigo-700);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}
.hp-mapx .method-card input:checked + .body .method-glyph {
    background: linear-gradient(135deg, var(--indigo-500), var(--indigo-700));
    color: #fff;
}
.hp-mapx .method-glyph svg { width: 20px; height: 20px; }
.hp-mapx .radio-dot {
    width: 20px;
    height: 20px;
    border-radius: var(--r-pill);
    border: 2px solid var(--line-strong);
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .15s ease, background .15s ease;
}
.hp-mapx .radio-dot svg { width: 11px; height: 11px; color: #fff; opacity: 0; transition: opacity .15s ease; }
.hp-mapx .method-card input:checked + .body .radio-dot {
    border-color: var(--indigo-600);
    background: var(--indigo-600);
}
.hp-mapx .method-card input:checked + .body .radio-dot svg { opacity: 1; }

/* Alpine drives the selected state on the offline payment page: binding
   `checked` fights the browser's own toggle, so a class carries it instead. */
.hp-mapx .method-card .body.is-selected {
    border-color: var(--indigo-600);
    background: var(--indigo-50);
    box-shadow: var(--glow-indigo);
}
.hp-mapx .method-card .body.is-selected .method-glyph {
    background: linear-gradient(135deg, var(--indigo-500), var(--indigo-700));
    color: #fff;
}
.hp-mapx .method-card .body.is-selected .radio-dot {
    border-color: var(--indigo-600);
    background: var(--indigo-600);
}
.hp-mapx .method-card .body.is-selected .radio-dot svg { opacity: 1; }
.hp-mapx .method-name { font-weight: 700; font-size: 15px; color: var(--navy-900); }
.hp-mapx .method-desc { font-size: 13px; color: var(--ink-soft); margin: 0; }
.hp-mapx .method-hint { font-size: 12px; color: var(--ink-faint); margin: 0; }
.hp-mapx .method-card input:disabled { cursor: default; }
.hp-mapx .method-card input:disabled + .body { opacity: .55; box-shadow: none; }
.hp-mapx .method-card.warn input:checked + .body {
    border-color: var(--red-600);
    background: var(--red-50);
    box-shadow: 0 0 0 4px rgba(192, 57, 43, .12);
}
.hp-mapx .method-card.warn input:checked + .body .method-glyph {
    background: linear-gradient(135deg, #E14434, #B5382B);
    color: #fff;
}
.hp-mapx .method-card.warn input:checked + .body .radio-dot {
    background: var(--red-600);
    border-color: var(--red-600);
}

/* ---------- Installments ---------- */
.hp-mapx .seq-note {
    display: flex;
    gap: 10px;
    background: var(--indigo-50);
    border: 1px solid var(--line);
    border-radius: var(--r-card);
    padding: 12px 16px;
    font-size: 13px;
    color: var(--ink-soft);
    margin-bottom: 14px;
}
.hp-mapx .seq-note svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--indigo-600); }

.hp-mapx .select-all-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1.5px solid var(--line);
    border-radius: var(--r-card);
    background: var(--card-sub);
    margin-bottom: 14px;
    cursor: pointer;
    position: relative;
}
.hp-mapx .select-all-row .txt { font-weight: 600; font-size: 13.5px; }

.hp-mapx .inst-list { display: flex; flex-direction: column; gap: 10px; position: relative; }
.hp-mapx .inst-list::before {
    content: "";
    position: absolute;
    left: 33px;
    top: 24px;
    bottom: 24px;
    width: 2px;
    background: var(--line-strong);
    border-radius: 2px;
}
.hp-mapx .inst-item { position: relative; margin: 0; }
.hp-mapx .inst-item input,
.hp-mapx .select-all-row input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    left: 0;
    top: 0;
    cursor: pointer;
    z-index: 1;
}
.hp-mapx .inst-item .body {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1.5px solid var(--line);
    border-radius: var(--r-card);
    padding: 13px 16px;
    background: var(--card);
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.hp-mapx .inst-item:hover .body { border-color: var(--line-strong); box-shadow: var(--shadow-lift); }
.hp-mapx .inst-item input:checked + .body {
    border-color: var(--indigo-600);
    background: var(--indigo-50);
    box-shadow: var(--glow-indigo);
}
.hp-mapx .inst-seq {
    width: 34px;
    height: 34px;
    border-radius: var(--r-pill);
    background: var(--card-sub);
    border: 2px solid var(--line-strong);
    color: var(--ink-soft);
    font-size: 13.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    font-variant-numeric: tabular-nums;
}
.hp-mapx .inst-item input:checked + .body .inst-seq {
    background: linear-gradient(135deg, var(--indigo-500), var(--indigo-700));
    border-color: transparent;
    color: #fff;
}
.hp-mapx .inst-main { flex: 1; min-width: 0; }
.hp-mapx .inst-title { font-weight: 600; font-size: 14px; color: var(--navy-900); }
.hp-mapx .inst-due { font-size: 12.5px; color: var(--ink-faint); }
.hp-mapx .inst-amt {
    font-weight: 700;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
    color: var(--navy-900);
    flex: none;
}
.hp-mapx .hp-check {
    width: 21px;
    height: 21px;
    border-radius: var(--r-pill);
    border: 2px solid var(--line-strong);
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card);
    transition: background .15s ease, border-color .15s ease;
}
.hp-mapx .select-all-row .hp-check { border-radius: 7px; }
.hp-mapx .hp-check svg { width: 11px; height: 11px; color: #fff; opacity: 0; transition: opacity .12s ease; }
.hp-mapx .inst-item input:checked + .body .hp-check,
.hp-mapx .select-all-row input:checked ~ .hp-check {
    background: var(--indigo-600);
    border-color: var(--indigo-600);
}
.hp-mapx .inst-item input:checked + .body .hp-check svg,
.hp-mapx .select-all-row input:checked ~ .hp-check svg { opacity: 1; }

.hp-mapx .inst-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding: 14px 18px;
    border-radius: var(--r-card);
    background: linear-gradient(135deg, var(--green-50), #F0FBF5);
    border: 1px solid rgba(18, 161, 94, .22);
    font-size: 13.5px;
}
.hp-mapx .inst-summary .count { font-weight: 600; color: var(--green-700); }
.hp-mapx .inst-summary .total {
    font-weight: 800;
    font-size: 18px;
    color: var(--green-700);
    font-variant-numeric: tabular-nums;
}

/* ---------- Notices ---------- */
.hp-mapx .notice {
    display: flex;
    gap: 10px;
    border-radius: var(--r-card);
    padding: 12px 16px;
    font-size: 13px;
}
.hp-mapx .notice svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.hp-mapx .notice.info { background: var(--indigo-50); border: 1px solid var(--line); color: var(--ink-soft); }
.hp-mapx .notice.warn { background: var(--amber-50); border: 1px solid rgba(154, 107, 31, .28); color: var(--amber-700); }
.hp-mapx .notice.danger { background: var(--red-50); border: 1px solid rgba(192, 57, 43, .28); color: var(--red-600); }

/* ---------- Buttons ---------- */
.hp-mapx .hp-btn {
    appearance: none;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    border-radius: var(--r-pill);
    padding: 13px 24px;
    cursor: pointer;
    border: 1.5px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    transition: box-shadow .15s ease, background .15s ease, color .15s ease;
}
.hp-mapx .hp-btn-ghost {
    background: transparent;
    border-color: var(--line-strong);
    color: var(--ink-soft);
    flex: 0 0 auto;
}
.hp-mapx .hp-btn-ghost:hover { background: var(--card-sub); color: var(--ink); }
.hp-mapx .hp-btn-confirm {
    flex: 1;
    background: linear-gradient(135deg, var(--green-500), var(--green-700));
    color: #fff;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 8px 20px rgba(18, 161, 94, .32);
}
.hp-mapx .hp-btn-confirm:hover { box-shadow: 0 10px 26px rgba(18, 161, 94, .42); color: #fff; }
.hp-mapx .hp-btn-danger {
    flex: 1;
    background: linear-gradient(135deg, #E14434, #B5382B);
    color: #fff;
    box-shadow: 0 8px 20px rgba(192, 57, 43, .3);
}
.hp-mapx .hp-btn-danger:hover { box-shadow: 0 10px 26px rgba(192, 57, 43, .4); color: #fff; }
.hp-mapx .hp-btn[disabled] { opacity: .55; cursor: not-allowed; }
.hp-mapx .hp-btn .spinner {
    width: 16px;
    height: 16px;
    border-radius: var(--r-pill);
    border: 2.5px solid currentColor;
    border-top-color: transparent;
    animation: hp-spin .7s linear infinite;
}
@keyframes hp-spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
    .hp-mapx .method-grid,
    .hp-mapx .payer-grid { grid-template-columns: 1fr; }
    .hp-mapx .panel-head,
    .hp-mapx .panel-body { padding-left: 20px; padding-right: 20px; }
    .hp-mapx .panel-foot { padding-left: 20px; padding-right: 20px; flex-direction: column-reverse; }
    .hp-mapx .hp-btn-ghost { width: 100%; }
    .hp-mapx .amount-due { text-align: left; width: 100%; }
}
