import streamlit as st # Inline-style helpers — all colors use either Streamlit CSS vars or # semi-transparent rgba so they render correctly in both light and dark mode. _BADGE = ( 'display:inline-flex;align-items:center;gap:4px;padding:3px 10px;' 'border-radius:20px;font-size:0.78rem;font-weight:600;' 'white-space:nowrap;line-height:1.4;' ) def verdict_pill(verdict: str) -> str: cfg = { "eligible": ("rgba(34,197,94,0.15)", "#22C55E", "✅ Eligible"), "not_eligible": ("rgba(239,68,68,0.15)", "#EF4444", "❌ Not Eligible"), "needs_review": ("rgba(245,158,11,0.15)", "#F59E0B", "⚠️ Needs Review"), } bg, fg, label = cfg.get(verdict, ("rgba(128,128,128,0.1)", "var(--text-color)", verdict)) return (f'{label}') def category_badge(category: str) -> str: cfg = { "financial": ("rgba(37,99,235,0.12)", "#3B82F6", "💰 Financial"), "technical": ("rgba(34,197,94,0.12)", "#22C55E", "🔧 Technical"), "compliance": ("rgba(245,158,11,0.12)", "#F59E0B", "📋 Compliance"), } bg, fg, label = cfg.get(category, ("rgba(128,128,128,0.1)", "var(--text-color)", category)) return (f'{label}') def ocr_tier_badge(source_type: str) -> str: cfg = { "text_pdf": ("rgba(100,116,139,0.12)", "#94A3B8", "📄 Typed PDF"), "tesseract": ("rgba(124,58,237,0.12)", "#8B5CF6", "🔍 Tesseract"), "vision_llm": ("rgba(234,88,12,0.12)", "#F97316", "👁 Vision LLM"), } bg, fg, label = cfg.get(source_type, ("rgba(128,128,128,0.1)", "var(--text-color)", source_type)) return (f'{label}') def mandatory_badge(mandatory: bool) -> str: if mandatory: return (f'🔴 Mandatory') return (f'🟡 Optional') def confidence_bar(value: float, label: str = "Confidence") -> None: pct = min(max(value, 0.0), 1.0) color = "#22C55E" if pct >= 0.80 else "#F59E0B" if pct >= 0.55 else "#EF4444" st.markdown( f"""