/* ==========================================================================
   Payment Gateways (/payment-gateways): the list pages' look (sl4, pu4, rc4)
   --------------------------------------------------------------------------
   App.renderPaymentGatewaysPage() in assets/js/app/account-billing.js. The
   page wrapper is .sx-wrap.lp2.lp2-tone-cyan.lp2-st.st-pg.pg5: the settings
   kit (pages-settings.css) still gives the header, switches, status chips,
   notes and save bars; this file adds, scoped to .pg5:
   - the top: a summary card saying where customers' money goes now, with a
     next-step strip beside it (under it on a phone), like Sales and Purchases;
   - "How it works": four plain facts (a row you swipe on a phone);
   - the providers heading with a chip per provider that jumps to its card;
   - one card per provider: logo, name, status, the boxes, its own Save.
   Two cards across from 1100px. Primary text true black; status colours
   (green, amber, red) only for status. Linked after pages-settings.css.
   ========================================================================== */

.st-pg.pg5 { --pg5-line: #e3e8ef; --pg5-soft: #f6f8fb; }
@media (min-width: 1100px) { .st-pg.pg5 { max-width: 1080px; } }

/* ---- Loading -------------------------------------------------------------- */
.st-pg.pg5 .pg5-sk-hero { flex: 999 1 520px; height: 220px; border-radius: 22px; }
.st-pg.pg5 .pg5-sk-strip { flex: 1 1 280px; height: 220px; border-radius: 20px; }
.st-pg.pg5 .pg5-sk-card { height: 460px; border-radius: 22px; }

/* ---- Top: summary card + next step ------------------------------------------ */
.st-pg.pg5 .pg5-top { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 18px; }
.st-pg.pg5 .pg5-top > .pg5-hero { flex: 999 1 520px; min-width: 0; margin: 0; }
.st-pg.pg5 .pg5-top > .pg5-strip { flex: 1 1 280px; }

.st-pg.pg5 .pg5-hero { padding: 18px 20px 16px; }
.st-pg.pg5 .pg5-hero .sx-hero-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.st-pg.pg5 .pg5-hero .sx-hero-eyebrow { color: rgba(255, 255, 255, .92); }
/* where the money goes now: a white pill with a status dot */
.st-pg.pg5 .pg5-state {
    display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0;
    padding: 5px 12px 5px 10px; border-radius: 999px; background: #fff; color: #000;
    font-size: .74rem; font-weight: 850; line-height: 1.3; white-space: nowrap;
    box-shadow: 0 6px 16px -10px rgba(0, 0, 0, .55);
}
.st-pg.pg5 .pg5-state > i { width: 9px; height: 9px; border-radius: 50%; background: #64748b; box-shadow: 0 0 0 3px rgba(100, 116, 139, .22); }
.st-pg.pg5 .pg5-state.is-ok > i { background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, .22); }
.st-pg.pg5 .pg5-state.is-warn > i { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .25); }
.st-pg.pg5 .pg5-state.is-bad > i { background: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, .2); }
.st-pg.pg5 .pg5-hero-val {
    position: relative; z-index: 1; margin: 14px 0 6px;
    font-family: var(--font-display); font-size: clamp(1.35rem, 4.8vw, 1.9rem); font-weight: 800;
    letter-spacing: -.025em; line-height: 1.12; color: #fff; overflow-wrap: anywhere;
}
.st-pg.pg5 .pg5-hero-val b { font-weight: 900; }
.st-pg.pg5 .pg5-hero .lp2-hero-note { max-width: 62ch; font-size: .82rem; line-height: 1.5; color: rgba(255, 255, 255, .94); }
.st-pg.pg5 .pg5-hero .lp2-stats { margin-top: 14px; }
.st-pg.pg5 .pg5-hero .lp2-stat { padding: 9px 12px; border-radius: 14px; background: rgba(255, 255, 255, .13); }
.st-pg.pg5 .pg5-hero .lp2-stat b { font-size: .95rem; }
.st-pg.pg5 .pg5-hero .lp2-stat span { font-size: .7rem; color: rgba(255, 255, 255, .9); }

/* the next step: soft colour by status, its button under the words */
.st-pg.pg5 .pg5-strip {
    display: flex; flex-wrap: wrap; align-items: center; align-content: center; gap: 12px;
    min-width: 0; padding: 16px; border-radius: 22px; border: 1px solid;
}
.st-pg.pg5 .pg5-strip-ic { width: 44px; height: 44px; flex: none; border-radius: 14px; display: grid; place-items: center; font-size: 1.2rem; }
.st-pg.pg5 .pg5-strip > div { flex: 1 1 0; min-width: 0; }
.st-pg.pg5 .pg5-strip b { display: block; font-size: 1rem; font-weight: 900; line-height: 1.25; color: #000; overflow-wrap: anywhere; }
.st-pg.pg5 .pg5-strip > div > span { display: block; margin-top: 4px; font-size: .8rem; font-weight: 650; line-height: 1.45; }
.st-pg.pg5 .pg5-strip > button {
    flex: 1 1 100%; min-height: 46px; padding: 0 16px; border: 0; border-radius: 14px;
    color: #fff; font: inherit; font-size: .9rem; font-weight: 900; cursor: pointer; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.st-pg.pg5 .pg5-strip > button:hover { filter: brightness(1.08); }
.st-pg.pg5 .pg5-strip > button:focus-visible { outline: 3px solid currentColor; outline-offset: 2px; }
.st-pg.pg5 .pg5-strip.is-ok { background: #f0fdf4; border-color: #bbf7d0; }
.st-pg.pg5 .pg5-strip.is-ok .pg5-strip-ic { background: #dcfce7; color: #166534; }
.st-pg.pg5 .pg5-strip.is-ok > div > span { color: #14532d; }
.st-pg.pg5 .pg5-strip.is-ok > button { background: linear-gradient(180deg, #22c55e, #15803d); }
.st-pg.pg5 .pg5-strip.is-warn { background: #fffbeb; border-color: #fde68a; }
.st-pg.pg5 .pg5-strip.is-warn .pg5-strip-ic { background: #fef3c7; color: #92400e; }
.st-pg.pg5 .pg5-strip.is-warn > div > span { color: #78350f; }
.st-pg.pg5 .pg5-strip.is-warn > button { background: #78350f; }
.st-pg.pg5 .pg5-strip.is-bad { background: #fef2f2; border-color: #fecaca; }
.st-pg.pg5 .pg5-strip.is-bad .pg5-strip-ic { background: #fee2e2; color: #991b1b; }
.st-pg.pg5 .pg5-strip.is-bad > div > span { color: #7f1d1d; }
.st-pg.pg5 .pg5-strip.is-bad > button { background: #991b1b; }
/* nothing switched on yet: the page's own colour, and the app's green "go" button */
.st-pg.pg5 .pg5-strip.is-info { background: #ecfeff; border-color: #a5f3fc; }
.st-pg.pg5 .pg5-strip.is-info .pg5-strip-ic { background: #cffafe; color: #155e75; }
.st-pg.pg5 .pg5-strip.is-info > div > span { color: #164e63; }
.st-pg.pg5 .pg5-strip.is-info > button { background: linear-gradient(180deg, #22c55e, #15803d); }

/* ---- How it works ------------------------------------------------------------ */
.st-pg.pg5 .pg5-how { margin: 0 0 20px; }
.st-pg.pg5 .pg5-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.st-pg.pg5 .pg5-fact {
    display: flex; align-items: flex-start; gap: 11px; min-width: 0; padding: 13px;
    border-radius: 18px; background: color-mix(in srgb, var(--lp2-h3) 5%, #fff);
    border: 1px solid color-mix(in srgb, var(--lp2-h3) 18%, #fff);
}
.st-pg.pg5 .pg5-fact-ic {
    width: 36px; height: 36px; flex: none; border-radius: 12px; display: grid; place-items: center;
    color: #fff; font-size: .98rem; background: linear-gradient(135deg, var(--lp2-h3), var(--lp2-h2));
    box-shadow: 0 6px 14px -8px var(--lp2-glow);
}
.st-pg.pg5 .pg5-fact > div { min-width: 0; }
.st-pg.pg5 .pg5-fact b { display: block; font-size: .86rem; font-weight: 850; line-height: 1.3; color: #000; }
.st-pg.pg5 .pg5-fact > div > span { display: block; margin-top: 3px; font-size: .76rem; font-weight: 600; line-height: 1.45; color: #334155; }
@media (max-width: 999px) { .st-pg.pg5 .pg5-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* phones: one row you swipe, running to the screen edges; the next card peeks in */
@media (max-width: 599px) {
    .st-pg.pg5 .pg5-facts {
        display: flex; overflow-x: auto; overflow-y: hidden; gap: 10px;
        margin: 0 -16px; padding: 2px 16px 6px;
        scroll-snap-type: x mandatory; scroll-padding: 0 16px; overscroll-behavior-x: contain; scrollbar-width: none;
    }
    .st-pg.pg5 .pg5-facts::-webkit-scrollbar { display: none; }
    .st-pg.pg5 .pg5-fact { flex: 0 0 76%; scroll-snap-align: start; }
}

/* ---- Providers heading + chips ----------------------------------------------- */
.st-pg.pg5 .pg5-head { margin: 0 0 12px; }
.st-pg.pg5 .pg5-head .lp2-cap { flex-wrap: wrap; row-gap: 2px; margin-bottom: 8px; }
.st-pg.pg5 .pg5-head .lp2-cap em { color: #155e75; }
.st-pg.pg5 .pg5-jump {
    display: flex; align-items: center; gap: 6px; overflow-x: auto;
    padding: 3px; margin: -3px; scrollbar-width: none;
}
.st-pg.pg5 .pg5-jump::-webkit-scrollbar { display: none; }
.st-pg.pg5 .pg5-jchip {
    flex: none; display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px 0 12px;
    border-radius: 999px; border: 1px solid #dfe3ec; background: #fff; color: #000;
    font: inherit; font-size: .82rem; font-weight: 850; white-space: nowrap; cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.st-pg.pg5 .pg5-jchip:hover { border-color: #94a3b8; }
.st-pg.pg5 .pg5-jchip:focus-visible { outline: 3px solid color-mix(in srgb, var(--lp2-h3) 45%, transparent); outline-offset: 2px; }
.st-pg.pg5 .pg5-jchip small { font-size: .74rem; font-weight: 700; color: #475569; }
.st-pg.pg5 .pg5-dot { width: 9px; height: 9px; border-radius: 50%; background: #94a3b8; }
.st-pg.pg5 .pg5-jchip.is-ok { border-color: #bbf7d0; background: #f0fdf4; }
.st-pg.pg5 .pg5-jchip.is-ok .pg5-dot { background: #16a34a; }
.st-pg.pg5 .pg5-jchip.is-ok small { color: #166534; }
.st-pg.pg5 .pg5-jchip.is-warn { border-color: #fde68a; background: #fffbeb; }
.st-pg.pg5 .pg5-jchip.is-warn .pg5-dot { background: #f59e0b; }
.st-pg.pg5 .pg5-jchip.is-warn small { color: #92400e; }
.st-pg.pg5 .pg5-jchip.is-bad { border-color: #fecaca; background: #fef2f2; }
.st-pg.pg5 .pg5-jchip.is-bad .pg5-dot { background: #dc2626; }
.st-pg.pg5 .pg5-jchip.is-bad small { color: #991b1b; }

/* ---- Provider cards ------------------------------------------------------------ */
.st-pg.pg5 .pg5-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
@media (min-width: 1100px) { .st-pg.pg5 .pg5-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } }
.st-pg.pg5 .pg5-card {
    margin: 0; border-radius: 22px; border: 1.5px solid var(--pg5-line);
    scroll-margin-top: 84px; transition: border-color .2s ease;
}
/* the card's edge says how it stands: green on, amber test keys, red details missing */
.st-pg.pg5 .pg5-card.pg5-on { border-color: #86efac; }
.st-pg.pg5 .pg5-card.pg5-test { border-color: #fcd34d; }
.st-pg.pg5 .pg5-card.pg5-need { border-color: #fca5a5; }
.st-pg.pg5 .pg5-card.pg5-flash { animation: pg5-flash 1.6s ease; }
@keyframes pg5-flash {
    0%, 55% { outline: 3px solid color-mix(in srgb, var(--lp2-h3) 55%, transparent); outline-offset: 3px; }
    100% { outline: 3px solid transparent; outline-offset: 3px; }
}
@media (prefers-reduced-motion: reduce) { .st-pg.pg5 .pg5-card.pg5-flash { animation: none; } }

/* head: a soft band in the page's colour (green, amber or red once the
   provider is on, on test keys or missing details), its logo on a white plate */
.st-pg.pg5 .pg5-card-head {
    padding: 14px 16px 13px; border-radius: 20px 20px 0 0;
    background: linear-gradient(180deg, color-mix(in srgb, var(--lp2-h3) 9%, #fff), color-mix(in srgb, var(--lp2-h3) 2%, #fff));
    border-bottom: 1px solid color-mix(in srgb, var(--lp2-h3) 14%, #eef1f5);
}
.st-pg.pg5 .pg5-on .pg5-card-head { background: linear-gradient(180deg, #dcfce7, #f7fef9); border-bottom-color: #bbf7d0; }
.st-pg.pg5 .pg5-test .pg5-card-head { background: linear-gradient(180deg, #fef3c7, #fffdf5); border-bottom-color: #fde68a; }
.st-pg.pg5 .pg5-need .pg5-card-head { background: linear-gradient(180deg, #fee2e2, #fffafa); border-bottom-color: #fecaca; }
.st-pg.pg5 .pg5-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.st-pg.pg5 .pg5-card-top > .st-chip { padding: 4px 10px; font-size: .72rem; }
.st-pg.pg5 .pg5-logo {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    height: 46px; min-width: 64px; max-width: 70%; padding: 0 14px; box-sizing: border-box;
    border-radius: 14px; background: #fff; border: 1px solid #e2e8f0;
    box-shadow: 0 6px 14px -10px rgba(15, 23, 42, .35);
}
.st-pg.pg5 .pg5-logo img { display: block; height: 22px; width: auto; max-width: 132px; object-fit: contain; }
.st-pg.pg5 .pg5-logo.is-sq img { height: 34px; max-width: 64px; }
.st-pg.pg5 .pg5-logo > i { display: none; font-size: 1.25rem; color: color-mix(in srgb, var(--sx-c) 85%, #000); }
.st-pg.pg5 .pg5-logo.is-icon { width: 46px; min-width: 46px; padding: 0; }
.st-pg.pg5 .pg5-logo.is-icon > i { display: block; }
.st-pg.pg5 .pg5-card-t { margin-top: 12px; min-width: 0; }
.st-pg.pg5 .pg5-card-t h3 {
    margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px;
    font-size: 1.1rem; font-weight: 900; letter-spacing: -.01em; line-height: 1.25; color: #000;
}
.st-pg.pg5 .pg5-top-tag {
    font-style: normal; font-size: .68rem; font-weight: 800; letter-spacing: 0; white-space: nowrap;
    padding: 2px 9px; border-radius: 999px; background: #fff; color: #155e75; border: 1px solid #a5f3fc;
}
.st-pg.pg5 .pg5-card-t > span { display: block; margin-top: 3px; font-size: .8rem; font-weight: 600; line-height: 1.4; color: #334155; }

.st-pg.pg5 .pg5-card-body { padding: 16px; }
.st-pg.pg5 .pg5-card-body > .form-stack { display: flex; flex-direction: column; gap: 14px; }
.st-pg.pg5 .pg5-card-body .lp2-note { margin: 0; border-radius: 14px; }

/* the main switch: a soft box that turns green once it is on */
.st-pg.pg5 .pg5-card .st-switch-row.st-switch-main {
    padding: 12px 14px; border: 1px solid var(--pg5-line); border-radius: 16px; background: var(--pg5-soft);
    transition: background .15s ease, border-color .15s ease;
}
.st-pg.pg5 .pg5-card .st-switch-row.st-switch-main:has(input:checked) { background: #f0fdf4; border-color: #bbf7d0; }
.st-pg.pg5 .pg5-card .st-switch-row.st-switch-main .st-switch-t b { font-size: .92rem; font-weight: 850; }
.st-pg.pg5 .pg5-card .st-switch-row.st-switch-main .st-switch-t > span { color: #334155; }
body[data-app-page] .st-pg.pg5 .pg5-card input.st-switch:checked { background: #16a34a; }

/* where to find the keys: numbered steps */
.st-pg.pg5 .pg5-where {
    padding: 12px 14px; border-radius: 16px; background: #fff;
    border: 1px dashed color-mix(in srgb, var(--lp2-h3) 40%, #cbd5e1);
}
.st-pg.pg5 .pg5-where-h { display: flex; align-items: center; gap: 8px; font-size: .86rem; color: #000; }
.st-pg.pg5 .pg5-where-h b { font-weight: 850; }
.st-pg.pg5 .pg5-where-h i { color: var(--lp2-deep); font-size: .95rem; }
.st-pg.pg5 .pg5-steps { list-style: none; counter-reset: pg5-step; margin: 9px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.st-pg.pg5 .pg5-steps li { counter-increment: pg5-step; display: flex; align-items: flex-start; gap: 9px; font-size: .8rem; font-weight: 600; line-height: 1.45; color: #1f2937; }
.st-pg.pg5 .pg5-steps li::before {
    content: counter(pg5-step); flex: none; width: 21px; height: 21px; border-radius: 50%;
    display: grid; place-items: center; font-size: .68rem; font-weight: 900; line-height: 1; color: #fff;
    background: var(--lp2-deep);
}
.st-pg.pg5 .pg5-steps li > span { min-width: 0; overflow-wrap: anywhere; padding-top: 1px; }
.st-pg.pg5 .pg5-steps b { color: #000; font-weight: 800; }
.st-pg.pg5 .pg5-where-x { margin-top: 11px; }
.st-pg.pg5 .pg5-where-x .btn { display: inline-flex; align-items: center; gap: 6px; width: auto; min-height: 38px; padding: 0 14px; border-radius: 12px; }

/* the boxes */
.st-pg.pg5 .pg5-card .input-group label { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 4px; font-size: .82rem; font-weight: 800; color: #000; }
.st-pg.pg5 .pg5-plain { font-weight: 650; color: #475569; }
.st-pg.pg5 .pg5-card .input-group label .required { color: #b91c1c; }
.st-pg.pg5 .pg5-card .st-opt { margin-left: 2px; }
.st-pg.pg5 .pg5-card .st-hint { color: #475569; }
.st-pg.pg5 .pg5-card .st-saved-tag { display: inline-flex; align-items: center; gap: 3px; margin-left: 4px; padding: 1px 8px; border-radius: 999px; background: #dcfce7; color: #166534; }
body[data-app-page="payment-gateways"] .st-pg.pg5 .pg5-card .input-group > input {
    height: 46px; border-radius: 12px; font-size: .9rem; color: #000;
}
/* a saved secret: dots and its last 4 characters, with Replace */
body[data-app-page="payment-gateways"] .st-pg.pg5 .pg5-savedrow input {
    height: 42px; background: #f0fdf4; border-color: #bbf7d0; color: #14532d;
    font-family: var(--font-mono); font-size: .86rem; letter-spacing: .08em;
}
body[data-app-page="payment-gateways"] .st-pg.pg5 .st-webhook-row .btn { height: 42px; min-height: 42px; border-radius: 12px; }
body[data-app-page="payment-gateways"] .st-pg.pg5 .st-webhook-row input[type="password"] { height: 42px; }
.st-pg.pg5 .st-webhook-row .btn[aria-label] { width: 44px; }

/* payment alerts (the bold words in its line stay in the sentence) */
.st-pg.pg5 .pg5-card .st-webhook { border-radius: 16px; border-color: #bae6fd; }
.st-pg.pg5 .st-webhook-t span b { display: inline; font-size: inherit; }
.st-pg.pg5 .pg5-auto {
    display: flex; align-items: flex-start; gap: 9px; padding: 10px 12px; border-radius: 14px;
    background: #f0fdf4; border: 1px solid #bbf7d0; font-size: .8rem; font-weight: 600; line-height: 1.45; color: #14532d;
}
.st-pg.pg5 .pg5-auto > i { color: #15803d; font-size: .95rem; margin-top: 1px; }
.st-pg.pg5 .pg5-auto b { color: #000; font-weight: 800; }

/* the card's own Save */
.st-pg.pg5 .pg5-card > .st-savebar { padding: 12px 14px 12px 16px; border-radius: 0 0 20px 20px; }
.st-pg.pg5 .pg5-card > .st-savebar .st-save-txt b { font-size: .84rem; }
.st-pg.pg5 .pg5-card > .st-savebar .st-save-btn { min-height: 42px; padding: 0 20px; border-radius: 12px; }
.st-pg.pg5 .pg5-card > .st-savebar.is-dirty { border-radius: 16px; }
/* phones: once it follows you down, it rides above the round menu button, not under it */
@media (max-width: 767px) {
    .st-pg.pg5 .pg5-card > .st-savebar.is-dirty { bottom: calc(var(--fixed-btn-size, 46px) + var(--fixed-btn-offset, 12px) + 22px); }
}

/* ---- Phones -------------------------------------------------------------------- */
@media (max-width: 599px) {
    .st-pg.pg5 .pg5-hero { padding: 16px 16px 14px; }
    .st-pg.pg5 .pg5-strip { padding: 14px; }
    .st-pg.pg5 .pg5-card-head { padding: 13px 14px 12px; }
    .st-pg.pg5 .pg5-card-body { padding: 14px; }
    .st-pg.pg5 .pg5-logo { height: 42px; padding: 0 12px; }
    .st-pg.pg5 .pg5-logo img { height: 20px; max-width: 112px; }
    .st-pg.pg5 .pg5-logo.is-sq img { height: 30px; }
    .st-pg.pg5 .pg5-logo.is-icon { width: 42px; min-width: 42px; }
}
