ai_econsult_demo / src /styles.py
Cardiosense-AG's picture
Create styles.py
e1abe02 verified
raw
history blame
1.2 kB
# src/styles.py
from __future__ import annotations
"""Minimal clinical styling helpers for Streamlit UI."""
from typing import Optional
try:
import streamlit as st # type: ignore
except Exception:
st = None # type: ignore
BASE_CSS = """
/* Compact spacing */
.block-container { padding-top: 1rem; padding-bottom: 1rem; }
/* Inputs: white background, light borders */
.stTextInput > div > div > input,
.stTextArea textarea, .stNumberInput input, .stSelectbox div[data-baseweb],
.stMultiSelect div[data-baseweb] {
background: #fff !important;
border: 1px solid #E5E7EB !important;
border-radius: 6px !important;
}
/* Badges */
.badge {
display: inline-block; padding: 0.15rem 0.5rem; border-radius: 9999px;
font-size: 0.75rem; line-height: 1rem; border: 1px solid #E5E7EB;
background: #F3F4F6; color: #111827;
}
.badge.accent {
background: #EFF6FF; color: #1D4ED8; border-color: #BFDBFE;
}
"""
def inject_base_css(extra: Optional[str] = None) -> None:
"""Inject base CSS (no-op if Streamlit unavailable)."""
if st is None:
return
css = BASE_CSS + ("\n" + extra if extra else "")
st.markdown(f"<style>{css}</style>", unsafe_allow_html=True)