:root {
    --navy: #171460;
    --navy-lt: #211d8a;
    --turq: #00c4ae;
    --turq-br: #00F6D9;
    --purp: #921CBA;
    --mag: #BE1BB8;
    --bg: #f5f6ff;
    --surface: #ffffff;
    --raise: #eef0fd;
    --border: #dcdff5;
    --text: #2c2c6e;
    --fog: #7072b0;
    --bright: #171460;
    --r: 12px;
    --r-sm: 7px;
    --shadow-sm: 0 1px 2px rgba(23,20,96,0.06);
    --shadow-md: 0 8px 24px rgba(23,20,96,0.08);
    --shadow-lg: 0 24px 60px rgba(23,20,96,0.16);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    background-image: radial-gradient(800px 400px at 90% 10%, rgba(0,196,174,0.07), transparent 60%), radial-gradient(600px 400px at 0% 80%, rgba(146,28,186,0.06), transparent 60%);
    font-family: 'Poppins', system-ui, -apple-system, sans-serif;
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

.mono {
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
}

.display {
    font-family: 'Poppins', sans-serif;
}

.stage {
    width: 100%;
    max-width: 920px;
    display: grid;
    grid-template-columns: 1fr 1.35fr;
    background: var(--surface);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    min-height: 600px;
    border: 1px solid var(--border);
}

@media (max-width: 800px) {
    .stage {
        grid-template-columns: 1fr;
        max-width: 480px;
    }

    .summary {
        order: 1;
    }

    .panel {
        order: 2;
    }
}

/* ── Summary side ── */
.summary {
    background: linear-gradient(165deg, var(--navy) 0%, var(--navy-lt) 55%, #1B1875 100%);
    color: #fff;
    padding: 40px 36px;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

    .summary::before {
        content: "";
        position: absolute;
        inset: 0;
        background-image: linear-gradient(rgba(0,246,217,0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(0,246,217,0.04) 1px, transparent 1px);
        background-size: 32px 32px;
        mask-image: radial-gradient(circle at 30% 20%, black, transparent 70%);
        pointer-events: none;
    }

    .summary::after {
        content: '';
        position: absolute;
        inset: 0;
        background: radial-gradient(ellipse 60% 50% at 0% 80%, rgba(146,28,186,0.15), transparent 60%);
        pointer-events: none;
    }

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}

    .brand img {
        width: 26px;
        height: 26px;
        object-fit: contain;
        flex-shrink: 0;
    }

    .brand span {
        font-family: 'Poppins', sans-serif;
        font-weight: 800;
        font-size: 17px;
        letter-spacing: -0.03em;
    }

        .brand span .highlight {
            color: var(--turq-br);
        }

    .brand small {
        display: block;
        font-size: 9.5px;
        color: rgba(255,255,255,0.4);
        font-weight: 600;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        margin-top: 1px;
    }

.merchant-row {
    margin-top: 34px;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.merchant-logo {
    width: 42px;
    height: 42px;
    border-radius: var(--r-sm);
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: 15px;
    color: var(--turq-br);
}

.merchant-meta .name {
    font-weight: 600;
    font-size: 14.5px;
}

.merchant-meta .desc {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    margin-top: 2px;
}

.amount-block {
    margin-top: 30px;
    position: relative;
    z-index: 1;
}

    .amount-block .label {
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.12em;
        color: rgba(255,255,255,0.4);
        font-weight: 600;
        margin-bottom: 6px;
    }

    .amount-block .amount {
        font-size: 42px;
        font-weight: 700;
        letter-spacing: -0.02em;
        line-height: 1;
    }

        .amount-block .amount span {
            font-size: 18px;
            color: rgba(255,255,255,0.5);
            margin-right: 6px;
            vertical-align: 4px;
        }

.ref-line {
    margin-top: 14px;
    font-size: 12px;
    color: rgba(255,255,255,0.35);
    position: relative;
    z-index: 1;
}

    .ref-line .val {
        color: rgba(255,255,255,0.7);
    }

.route-track {
    margin-top: auto;
    padding-top: 34px;
    position: relative;
    z-index: 1;
}

    .route-track .route-label {
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: 0.12em;
        color: rgba(255,255,255,0.3);
        font-weight: 600;
        margin-bottom: 14px;
    }

.route-line {
    position: relative;
    height: 46px;
}

    .route-line .track {
        position: absolute;
        top: 50%;
        left: 14px;
        right: 14px;
        height: 1px;
        background: repeating-linear-gradient(90deg, rgba(255,255,255,0.15) 0 5px, transparent 5px 10px);
    }

    .route-line .progress {
        position: absolute;
        top: 50%;
        left: 14px;
        height: 1px;
        width: 0%;
        background: var(--turq-br);
        box-shadow: 0 0 10px rgba(0,246,217,0.5);
        transition: width 0.6s cubic-bezier(.6,.1,.2,1);
    }

.route-node {
    position: absolute;
    top: 50%;
    transform: translate(-50%,-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    border: 1.5px solid rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .4s ease, background .4s ease, box-shadow .4s ease;
    z-index: 2;
}

    .route-node svg {
        width: 13px;
        height: 13px;
        opacity: 0.5;
        transition: opacity .4s ease;
    }

    .route-node.n1 {
        left: 14px;
    }

    .route-node.n2 {
        left: 50%;
    }

    .route-node.n3 {
        left: calc(100% - 14px);
    }

    .route-node.active {
        background: var(--turq-br);
        border-color: var(--turq-br);
        box-shadow: 0 0 0 5px rgba(0,246,217,0.2);
    }

        .route-node.active svg {
            opacity: 1;
            stroke: var(--navy);
        }

.route-caption {
    margin-top: 10px;
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    min-height: 16px;
}

.trust-row {
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10.5px;
    color: rgba(255,255,255,0.3);
    position: relative;
    z-index: 1;
    font-weight: 500;
    letter-spacing: 0.02em;
}

    .trust-row svg {
        width: 13px;
        height: 13px;
        opacity: 0.4;
        flex-shrink: 0;
    }

/* ── Form panel ── */
.panel {
    padding: 36px 38px 30px;
    display: flex;
    flex-direction: column;
    background: var(--surface);
}

.rail-switch {
    display: flex;
    background: var(--raise);
    border-radius: var(--r-sm);
    padding: 4px;
    gap: 4px;
    border: 1px solid var(--border);
}

.rail-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 8px;
    border-radius: 6px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 13px;
    color: var(--fog);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: background .25s ease, color .25s ease, box-shadow .25s ease;
}

    .rail-btn svg {
        width: 15px;
        height: 15px;
    }

    .rail-btn.active {
        background: var(--surface);
        color: var(--navy);
        box-shadow: var(--shadow-sm);
    }

.field-stack {
    margin-top: 26px;
    flex: 1;
}

.field {
    margin-bottom: 17px;
}

    .field label {
        display: block;
        font-size: 12px;
        font-weight: 600;
        color: var(--text);
        margin-bottom: 6px;
        letter-spacing: 0.01em;
    }

    .field .hint {
        font-weight: 500;
        color: var(--fog);
        margin-left: 4px;
    }

.input-wrap {
    position: relative;
}

    .input-wrap input {
        width: 100%;
        padding: 13px 14px;
        border-radius: var(--r-sm);
        border: 1.5px solid var(--border);
        background: var(--surface);
        font-family: 'JetBrains Mono', monospace;
        font-size: 14px;
        color: var(--text);
        outline: none;
        transition: border-color .18s ease, box-shadow .18s ease;
    }

        .input-wrap input::placeholder {
            color: var(--fog);
            font-family: 'Poppins', sans-serif;
            font-weight: 400;
        }

        .input-wrap input:focus {
            border-color: var(--turq);
            box-shadow: 0 0 0 3.5px rgba(0,196,174,0.12);
        }

        .input-wrap input.err {
            border-color: var(--mag);
        }

        .input-wrap input.ok {
            border-color: var(--turq);
        }

    .input-wrap .leading-icon {
        position: absolute;
        left: 13px;
        top: 50%;
        transform: translateY(-50%);
        width: 20px;
        height: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        pointer-events: none;
    }

    .input-wrap.has-icon input {
        padding-left: 42px;
    }

    .input-wrap .trailing {
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .input-wrap .check-mark {
        width: 18px;
        height: 18px;
        opacity: 0;
        transform: scale(0.6);
        transition: opacity .2s ease, transform .2s ease;
    }

        .input-wrap .check-mark.show {
            opacity: 1;
            transform: scale(1);
        }

.row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.row-3 {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr;
    gap: 14px;
}

.err-msg {
    font-size: 11px;
    color: var(--mag);
    margin-top: 5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity .2s ease, max-height .2s ease;
}

    .err-msg.show {
        opacity: 1;
        max-height: 20px;
        margin-top: 5px;
    }

.phone-wrap {
    display: flex;
    gap: 8px;
}

    .phone-wrap .code {
        width: 84px;
        padding: 13px 10px;
        border-radius: var(--r-sm);
        border: 1.5px solid var(--border);
        font-family: 'JetBrains Mono', monospace;
        font-size: 14px;
        color: var(--fog);
        background: var(--raise);
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 600;
        flex-shrink: 0;
    }

.network-badges {
    display: flex;
    gap: 8px;
    margin-top: 9px;
}

.network-chip {
    font-size: 11px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1.5px solid var(--border);
    color: var(--fog);
    transition: all .2s ease;
}

    .network-chip.active {
        border-color: var(--turq);
        color: var(--turq);
        background: rgba(0,196,174,0.07);
    }

.subtab-switch {
    display: inline-flex;
    background: var(--raise);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
    border: 1px solid var(--border);
}

.subtab-btn {
    border: none;
    background: transparent;
    padding: 6px 16px;
    border-radius: 999px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 11.5px;
    color: var(--fog);
    cursor: pointer;
    transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}

    .subtab-btn.active {
        background: var(--surface);
        color: var(--navy);
        box-shadow: var(--shadow-sm);
    }

.inst-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    margin-bottom: 2px;
}

.inst-count {
    font-size: 11px;
    color: var(--fog);
    font-weight: 500;
}

/* Caps the visible tile list to ~2 rows regardless of how many banks or
       SACCOs exist, so the panel height stays predictable as the directory
       grows — scroll for the rest. The layered background is the classic
       no-JS "scroll shadow" trick: the inner gradients scroll with the
       content and cancel out the outer ones, so the fade only shows on the
       edge(s) that actually have more content to reveal. */
.bank-grid-scroll {
    max-height: 152px;
    overflow-y: auto;
    padding-top: 8px;
    margin-top: 4px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    background: linear-gradient(var(--surface) 30%, rgba(255,255,255,0)) center top, linear-gradient(rgba(255,255,255,0), var(--surface) 70%) center bottom, radial-gradient(farthest-side at 50% 0, rgba(23,20,96,.14), rgba(23,20,96,0)) center top, radial-gradient(farthest-side at 50% 100%, rgba(23,20,96,.14), rgba(23,20,96,0)) center bottom;
    background-repeat: no-repeat;
    background-color: var(--surface);
    background-size: 100% 18px, 100% 18px, 100% 8px, 100% 8px;
    background-attachment: local, local, scroll, scroll;
}

    .bank-grid-scroll::-webkit-scrollbar {
        width: 6px;
    }

    .bank-grid-scroll::-webkit-scrollbar-track {
        background: transparent;
    }

    .bank-grid-scroll::-webkit-scrollbar-thumb {
        background: var(--border);
        border-radius: 999px;
    }

        .bank-grid-scroll::-webkit-scrollbar-thumb:hover {
            background: var(--turq);
        }

.bank-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
    padding-right: 8px;
}

.bank-tile {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    border: 1.5px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    text-align: left;
    font-family: 'Poppins', sans-serif;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease, transform .12s ease;
}

    .bank-tile:hover {
        border-color: var(--turq);
        transform: translateY(-1px);
        box-shadow: var(--shadow-sm);
    }

    .bank-tile:active {
        transform: translateY(0) scale(0.98);
    }

    .bank-tile.selected {
        border-color: var(--turq);
        background: rgba(0,196,174,0.07);
        box-shadow: 0 0 0 3.5px rgba(0,196,174,0.12);
    }

    .bank-tile .bank-avatar {
        width: 32px;
        height: 32px;
        border-radius: 9px;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #fff;
        font-weight: 800;
        font-size: 10.5px;
        letter-spacing: -0.02em;
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), 0 2px 6px rgba(23,20,96,0.12);
    }
        /* Logo variant of .bank-avatar: a white badge so brand logos with a
       transparent background sit cleanly against any tile state. */
        .bank-tile .bank-avatar.bank-avatar-logo {
            background: #fff;
            padding: 4px;
            box-shadow: 0 0 0 1px var(--border), 0 2px 6px rgba(23,20,96,0.08);
        }

            .bank-tile .bank-avatar.bank-avatar-logo img {
                width: 100%;
                height: 100%;
                object-fit: contain;
            }

    .bank-tile span {
        font-size: 12.5px;
        font-weight: 600;
        color: var(--text);
        line-height: 1.25;
    }

    .bank-tile .bank-check {
        position: absolute;
        top: -6px;
        right: -6px;
        width: 18px;
        height: 18px;
        padding: 3px;
        border-radius: 50%;
        background: var(--turq);
        box-shadow: 0 2px 6px rgba(0,196,174,0.45), 0 0 0 2px var(--surface);
        opacity: 0;
        transform: scale(0.4);
        transition: opacity .16s ease, transform .16s ease;
    }

    .bank-tile.selected .bank-check {
        opacity: 1;
        transform: scale(1);
    }

.inst-section-label {
    display: none;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--fog);
    text-transform: uppercase;
    letter-spacing: 0.09em;
    margin-top: 14px;
    margin-bottom: 2px;
}

    .inst-section-label:first-of-type {
        margin-top: 12px;
    }

.inst-no-results {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 26px 10px;
    color: var(--fog);
}

    .inst-no-results svg {
        opacity: 0.35;
    }

    .inst-no-results p {
        font-size: 12.5px;
        line-height: 1.5;
        max-width: 220px;
    }

    .inst-no-results .q {
        color: var(--text);
        font-weight: 600;
    }

.save-row {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 4px;
    margin-bottom: 8px;
}

    .save-row input[type=checkbox] {
        width: 17px;
        height: 17px;
        border-radius: 4px;
        accent-color: var(--turq);
        cursor: pointer;
    }

    .save-row label {
        font-size: 12px;
        color: var(--fog);
        font-weight: 500;
        cursor: pointer;
    }

.pay-btn {
    width: 100%;
    margin-top: 8px;
    padding: 15px;
    border: none;
    border-radius: var(--r-sm);
    background: linear-gradient(135deg, var(--turq-br), var(--turq));
    color: var(--navy);
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    transition: opacity .2s ease, transform .12s ease, box-shadow .2s ease;
    box-shadow: 0 6px 16px rgba(0,196,174,0.25);
}

    .pay-btn:hover {
        opacity: 0.92;
        box-shadow: 0 8px 20px rgba(0,196,174,0.35);
    }

    .pay-btn:active {
        transform: translateY(1px);
    }

    .pay-btn:disabled {
        opacity: 0.55;
        cursor: not-allowed;
        box-shadow: none;
    }

    .pay-btn .spinner {
        width: 16px;
        height: 16px;
        border-radius: 50%;
        border: 2px solid rgba(23,20,96,0.2);
        border-top-color: var(--navy);
        animation: spin .7s linear infinite;
        display: none;
    }

    .pay-btn.loading .spinner {
        display: block;
    }

    .pay-btn.loading .btn-label {
        display: none;
    }

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.secure-foot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 14px;
    font-size: 11px;
    color: var(--fog);
    font-weight: 500;
}

    .secure-foot svg {
        width: 11px;
        height: 11px;
    }

/* ── rail panels ── */
.rail-panel {
    display: none;
}

    .rail-panel.active {
        display: block;
    }

/* push-sent (mobile money) state */
.push-state {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 30px 6px 6px;
}

    .push-state.show {
        display: flex;
    }

.push-ring {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: rgba(0,196,174,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 22px;
}

    .push-ring::before, .push-ring::after {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: 50%;
        border: 1.5px solid rgba(0,196,174,0.3);
        animation: ripple 2.2s ease-out infinite;
    }

    .push-ring::after {
        animation-delay: 0.7s;
    }

@keyframes ripple {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.7);
        opacity: 0;
    }
}

.push-ring svg {
    width: 34px;
    height: 34px;
    color: var(--turq);
    position: relative;
    z-index: 1;
}

.push-state h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 17px;
    margin: 0 0 8px;
}

.push-state p {
    font-size: 13px;
    color: var(--fog);
    line-height: 1.55;
    max-width: 300px;
    margin: 0 0 22px;
}

.push-phone {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--text);
}

.push-timer {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--fog);
    margin-bottom: 18px;
}

.push-actions {
    display: flex;
    gap: 10px;
    width: 100%;
}

.ghost-btn {
    flex: 1;
    padding: 11px;
    border-radius: var(--r-sm);
    border: 1.5px solid var(--border);
    background: transparent;
    color: var(--fog);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: border-color .2s ease, color .2s ease;
    font-family: 'Poppins', sans-serif;
}

    .ghost-btn:hover {
        border-color: var(--turq);
        color: var(--turq);
    }

/* success state */
.success-state {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 6px 6px;
}

    .success-state.show {
        display: flex;
    }

.success-mark {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--turq);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    animation: pop .45s cubic-bezier(.34,1.56,.64,1);
}

@keyframes pop {
    0% {
        transform: scale(0);
    }

    70% {
        transform: scale(1.08);
    }

    100% {
        transform: scale(1);
    }
}

.success-mark svg {
    width: 32px;
    height: 32px;
    color: var(--navy);
}

.success-state h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 19px;
    margin: 0 0 6px;
}

.success-state p {
    font-size: 13px;
    color: var(--fog);
    margin: 0 0 4px;
}

.success-ref {
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--raise);
    border-radius: var(--r-sm);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--fog);
    width: 100%;
}

    .success-ref .k {
        color: var(--fog);
    }

    .success-ref .v {
        color: var(--text);
        font-weight: 600;
    }

.done-btn {
    margin-top: 22px;
    width: 100%;
    padding: 14px;
    border-radius: var(--r-sm);
    border: none;
    background: var(--navy);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
}

.card-icons {
    display: flex;
    gap: 5px;
}

    .card-icons svg {
        width: 48px;
        height: 32px;
        opacity: 0.9;
    }

/* ── responsive tweaks ── */
@media(max-width: 480px) {
    .panel {
        padding: 28px 18px 24px;
    }

    .summary {
        padding: 28px 18px;
    }

    .row-3 {
        grid-template-columns: 1fr;
    }

    .rail-btn {
        font-size: 11px;
        padding: 10px 4px;
        gap: 4px;
    }

        .rail-btn svg {
            width: 13px;
            height: 13px;
        }

    .bank-tile span {
        font-size: 11.5px;
    }
}
