"""Shared box formatting for CLI output (used by main and xls_parser)."""


def format_sep(width: int = 60) -> str:
    """Return a single-line separator using box-drawing characters (mini rule)."""
    return "─" * (width - 2)


def format_box(lines: list[str]) -> str:
    """Format a list of lines in a box (same style as state.py)."""
    pad = max(len(line) for line in lines) if lines else 50
    pad = max(pad, 50)
    width = pad + 4
    top = "┌" + "─" * (width - 2) + "┐"
    bottom = "└" + "─" * (width - 2) + "┘"
    middle = "\n".join("│ " + line + " " * (pad - len(line)) + " │" for line in lines)
    return f"{top}\n{middle}\n{bottom}"
