def markdown_links(text):
    """Return (label, url) tuples for inline Markdown links.

    Excludes images (![...](...)) and allows balanced parentheses
    in the URL portion.
    """
    links = []
    i = 0
    n = len(text)
    while i < n:
        j = text.find('[', i)
        if j == -1:
            break
        # Exclude images: a '!' immediately before the opening bracket
        if j > 0 and text[j - 1] == '!':
            i = j + 1
            continue
        k = text.find(']', j + 1)
        if k == -1:
            break
        # Link syntax requires '(' right after the closing bracket
        if k + 1 < n and text[k + 1] == '(':
            depth = 1
            p = k + 2
            while p < n and depth > 0:
                c = text[p]
                if c == '(':
                    depth += 1
                elif c == ')':
                    depth -= 1
                p += 1
            if depth == 0:
                label = text[j + 1:k]
                url = text[k + 2:p - 1]
                links.append((label, url))
                i = p
                continue
        i = k + 1
    return links
