Spaces:
Sleeping
Sleeping
Update src/brand.py
Browse files- src/brand.py +160 -358
src/brand.py
CHANGED
|
@@ -1,381 +1,183 @@
|
|
| 1 |
# src/brand.py
|
| 2 |
from __future__ import annotations
|
| 3 |
import streamlit as st
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
def inject_brand_css() -> None:
|
| 17 |
-
"""Inject once per run
|
| 18 |
-
|
| 19 |
<style>
|
| 20 |
-
:root {
|
| 21 |
-
--brand-primary:
|
| 22 |
-
--brand-primary-dark:
|
| 23 |
-
--brand-
|
| 24 |
-
--brand-
|
| 25 |
-
--brand-
|
| 26 |
-
--brand-
|
| 27 |
-
--brand-
|
| 28 |
-
--brand-
|
| 29 |
-
--
|
| 30 |
-
--
|
| 31 |
-
--
|
| 32 |
-
|
| 33 |
-
--
|
| 34 |
-
--
|
| 35 |
-
--ink-700:#334155;
|
| 36 |
-
--ink-500:#64748b;
|
| 37 |
-
--success-50:#ecfdf5;
|
| 38 |
-
--success-600:#059669;
|
| 39 |
-
--info-50:#eef6ff;
|
| 40 |
-
--info-600:#2563eb;
|
| 41 |
-
--brand-primary-600: #1E40AF;
|
| 42 |
-
--brand-primary-700: #1B2F7A;
|
| 43 |
-
--brand-accent: #10B981; /* accent mint */
|
| 44 |
-
--page-bg: #F7F8FB; /* softer background */
|
| 45 |
-
--card-bg: #FFFFFF;
|
| 46 |
-
--card-border: #E7E9F1;
|
| 47 |
-
--muted-text: #6B7280;
|
| 48 |
-
--title-text: #0F172A;
|
| 49 |
-
--bubble-user: #E8F1FF; /* lighter blue */
|
| 50 |
-
--bubble-bot: #E9FAF2; /* lighter mint */
|
| 51 |
--shadow-sm: 0 4px 14px rgba(15, 23, 42, .06);
|
| 52 |
--shadow-md: 0 10px 30px rgba(15, 23, 42, .08);
|
| 53 |
-
}}
|
| 54 |
-
|
| 55 |
-
html, body {{
|
| 56 |
-
background: var(--page-bg) !important;
|
| 57 |
-
}}
|
| 58 |
-
|
| 59 |
-
.block-container {{ padding-top: 1.2rem !important; }}
|
| 60 |
-
|
| 61 |
-
.brand-page-wrap{{
|
| 62 |
-
padding: 6px 8px 22px;
|
| 63 |
-
}}
|
| 64 |
-
|
| 65 |
-
.brand-page-header{{
|
| 66 |
-
display:flex; align-items:center; gap:14px; margin:0 0 12px 0;
|
| 67 |
-
}}
|
| 68 |
-
|
| 69 |
-
.brand-page-title{{
|
| 70 |
-
font-weight:800; letter-spacing:.2px; color:var(--ink-900);
|
| 71 |
-
font-size: clamp(26px, 2.7vw, 40px);
|
| 72 |
-
}}
|
| 73 |
-
|
| 74 |
-
.brand-page-sub{{
|
| 75 |
-
color:var(--ink-500); font-size:14px; margin-top:-6px;
|
| 76 |
-
}}
|
| 77 |
-
|
| 78 |
-
/* Fixed height hero for a stable side-by-side layout */
|
| 79 |
-
.login-hero img {{
|
| 80 |
-
width: 100%;
|
| 81 |
-
height: 560px; /* pick 540–620 to taste */
|
| 82 |
-
object-fit: cover;
|
| 83 |
-
border-radius: 12px;
|
| 84 |
-
}}
|
| 85 |
-
|
| 86 |
-
/* Streamlit forms have generous top margins; tighten them */
|
| 87 |
-
[data-testid="stForm"] {{
|
| 88 |
-
margin-top: 0 !important;
|
| 89 |
-
}}
|
| 90 |
-
|
| 91 |
-
/* Slightly round inputs */
|
| 92 |
-
[data-testid="stForm"] input,
|
| 93 |
-
[data-testid="stForm"] textarea,
|
| 94 |
-
[data-testid="stForm"] select {{
|
| 95 |
-
border-radius: 10px;
|
| 96 |
-
}}
|
| 97 |
-
|
| 98 |
-
/* Make primary buttons full width inside forms */
|
| 99 |
-
[data-testid="stForm"] .stButton > button {{
|
| 100 |
-
width: 100%;
|
| 101 |
-
}}
|
| 102 |
-
|
| 103 |
-
/* Whole row behaves like two panels with the same height */
|
| 104 |
-
.login-row {{ display:flex; gap: 28px; }}
|
| 105 |
-
|
| 106 |
-
/* Left: force hero panel height and make image fill it */
|
| 107 |
-
.login-hero {{ height: 620px; width: 100%; }}
|
| 108 |
-
.login-hero img {{ height: 100%; width: 100%; object-fit: cover; border-radius: 12px; }}
|
| 109 |
-
|
| 110 |
-
/* Right: a fixed-height shell that contains the Streamlit card */
|
| 111 |
-
.login-card-shell {{ height: 620px; width: 100%; display:flex; align-items:center; }}
|
| 112 |
-
|
| 113 |
-
/* Make the inner Streamlit container fill and center its content */
|
| 114 |
-
.login-card-shell > div[data-testid="stVerticalBlock"] {{
|
| 115 |
-
width:100%;
|
| 116 |
-
display:flex;
|
| 117 |
-
flex-direction:column;
|
| 118 |
-
justify-content:center; /* vertically center the form */
|
| 119 |
-
}}
|
| 120 |
-
|
| 121 |
-
/* Tidy form look */
|
| 122 |
-
[data-testid="stForm"] {{ margin-top: 0 !important; }}
|
| 123 |
-
[data-testid="stForm"] input, [data-testid="stForm"] textarea, [data-testid="stForm"] select {{ border-radius:10px; }}
|
| 124 |
-
[data-testid="stForm"] .stButton > button {{ width:100%; }}
|
| 125 |
-
|
| 126 |
-
/* Match login/signup form height with hero image */
|
| 127 |
-
.login-box {{
|
| 128 |
-
min-height: 620px; /* adjust to match hero image height */
|
| 129 |
-
display: flex;
|
| 130 |
-
flex-direction: column;
|
| 131 |
-
justify-content: center; /* center the form vertically */
|
| 132 |
-
}}
|
| 133 |
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
color: #fff !important;
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
box-shadow:
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
margin-bottom: 18px;
|
| 156 |
-
}}
|
| 157 |
-
|
| 158 |
-
[data-baseweb="tab"]{{
|
| 159 |
-
padding:10px 14px !important;
|
| 160 |
-
font-weight:600;
|
| 161 |
-
color: var(--ink-700);
|
| 162 |
-
}}
|
| 163 |
-
|
| 164 |
-
[data-baseweb="tab"][aria-selected="true"]{{
|
| 165 |
-
color: var(--brand-primary) !important;
|
| 166 |
-
background:#eef5ff;
|
| 167 |
-
border-radius:12px;
|
| 168 |
-
}}
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
/* ---------- CHAT TAB STYLES ---------- */
|
| 172 |
-
.chat-header{{
|
| 173 |
-
display:flex; align-items:center; gap:12px; margin-bottom:8px;
|
| 174 |
-
}}
|
| 175 |
-
|
| 176 |
-
.chat-title{{
|
| 177 |
-
font-size: clamp(22px, 2.2vw, 34px);
|
| 178 |
-
font-weight:800; color:var(--ink-900);
|
| 179 |
-
}}
|
| 180 |
-
|
| 181 |
-
.chat-input-card{{
|
| 182 |
-
background:var(--brand-card);
|
| 183 |
-
border:1px solid var(--brand-border);
|
| 184 |
-
border-radius:var(--brand-radius);
|
| 185 |
-
box-shadow:var(--brand-shadow);
|
| 186 |
-
padding:14px 14px 10px;
|
| 187 |
-
margin-bottom:14px;
|
| 188 |
-
}}
|
| 189 |
-
|
| 190 |
-
.chat-controls-row{{
|
| 191 |
-
display:flex; align-items:center; gap:10px; margin-top:4px;
|
| 192 |
-
}}
|
| 193 |
-
|
| 194 |
-
.chat-submit-btn > button{{
|
| 195 |
-
width: 160px; height:42px;
|
| 196 |
-
background: var(--brand-primary) !important;
|
| 197 |
-
border: none !important; color: white !important;
|
| 198 |
-
font-weight:700; border-radius:12px;
|
| 199 |
-
}}
|
| 200 |
-
|
| 201 |
-
.chat-submit-btn > button:hover{{
|
| 202 |
-
background: var(--brand-primary-600) !important;
|
| 203 |
-
}}
|
| 204 |
-
|
| 205 |
-
.chat-stream{{
|
| 206 |
-
display:flex; flex-direction:column; gap:12px;
|
| 207 |
-
}}
|
| 208 |
-
|
| 209 |
-
.badge.green{{ background:#dcfce7; color:var(--success-600); }}
|
| 210 |
-
|
| 211 |
-
/* Make Streamlit markdown in chat messages breathe less */
|
| 212 |
-
.msg p{{ margin:0.25rem 0; }}
|
| 213 |
-
|
| 214 |
-
/* Cards */
|
| 215 |
-
.card {{
|
| 216 |
-
background: var(--brand-card);
|
| 217 |
-
border: 1px solid var(--brand-border);
|
| 218 |
-
border-radius: var(--brand-radius-lg);
|
| 219 |
-
box-shadow: 0 6px 18px rgba(0,0,0,.06);
|
| 220 |
padding: 18px;
|
| 221 |
-
}
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
div[data-testid="stDataFrame"] {{
|
| 225 |
border-radius: 12px;
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
border:
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
}
|
| 246 |
-
.
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
.
|
| 257 |
-
|
| 258 |
-
}
|
| 259 |
-
|
| 260 |
-
.
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
.
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
}
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
.
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
}
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
}
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
}}
|
| 297 |
-
|
| 298 |
-
.msg-role{{ font-weight:700; color: var(--title-text); }}
|
| 299 |
-
|
| 300 |
-
.badge{{
|
| 301 |
-
background:#fff; border:1px solid var(--card-border); border-radius:999px;
|
| 302 |
-
padding:3px 10px; font-size:11px; box-shadow: var(--shadow-sm);
|
| 303 |
-
}}
|
| 304 |
-
|
| 305 |
-
/* ===== Analysis card ===== */
|
| 306 |
-
.analysis-card{{
|
| 307 |
-
background:linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
|
| 308 |
-
border:1px solid var(--card-border); border-left:4px solid var(--brand-accent);
|
| 309 |
-
border-radius:14px; padding:12px 14px; box-shadow: var(--shadow-sm);
|
| 310 |
-
}}
|
| 311 |
-
|
| 312 |
-
.analysis-card h4{{ margin:0 0 8px 0; font-size:15px; color: var(--title-text); }}
|
| 313 |
-
|
| 314 |
-
.analysis-grid{{
|
| 315 |
-
display:grid; grid-template-columns: repeat(2, minmax(0,1fr));
|
| 316 |
-
gap:8px; color:#111827;
|
| 317 |
-
}}
|
| 318 |
-
|
| 319 |
-
@media (max-width: 900px){{ .analysis-grid{ grid-template-columns:1fr; } }}
|
| 320 |
-
|
| 321 |
-
/* ===== Buttons (primary + secondary) ===== */
|
| 322 |
-
[data-testid="stButton"] > button {{
|
| 323 |
-
border-radius:12px !important; font-weight:700 !important;
|
| 324 |
-
border: none !important; box-shadow: var(--shadow-sm) !important;
|
| 325 |
-
}}
|
| 326 |
-
|
| 327 |
-
[data-testid="stButton"] > button[kind="primary"]{{
|
| 328 |
-
background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-600) 100%) !important;
|
| 329 |
-
color: #fff !important;
|
| 330 |
-
}}
|
| 331 |
-
|
| 332 |
-
[data-testid="stButton"] > button[kind="primary"]:hover{{
|
| 333 |
-
transform: translateY(-1px);
|
| 334 |
-
box-shadow: var(--shadow-md) !important;
|
| 335 |
-
filter: brightness(1.02);
|
| 336 |
-
}}
|
| 337 |
-
|
| 338 |
-
[data-testid="stButton"] > button[kind="secondary"]{{
|
| 339 |
-
background: #fff !important; color: var(--brand-primary) !important;
|
| 340 |
-
border: 1px solid var(--card-border) !important;
|
| 341 |
-
}}
|
| 342 |
-
|
| 343 |
-
/* ===== Submit button inside forms ===== */
|
| 344 |
-
form [type="submit"]{{
|
| 345 |
-
width: 100%; border-radius:12px; height: 42px;
|
| 346 |
-
font-weight: 800; letter-spacing:.15px;
|
| 347 |
-
background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-700) 100%);
|
| 348 |
-
color:#fff; box-shadow: var(--shadow-sm); border:none;
|
| 349 |
-
}}
|
| 350 |
-
|
| 351 |
-
form [type="submit"]:hover{{ box-shadow: var(--shadow-md); transform: translateY(-1px); }
|
| 352 |
-
|
| 353 |
-
/* ===== Tables from results ===== */
|
| 354 |
-
[data-testid="stDataFrame"] {{
|
| 355 |
-
border:1px solid var(--card-border); border-radius:12px; box-shadow: var(--shadow-sm);
|
| 356 |
-
}}
|
| 357 |
-
|
| 358 |
-
/* ===== Section headings ===== */
|
| 359 |
-
.brand-section-title{{
|
| 360 |
-
font-weight:800; font-size:22px; margin: 10px 0 8px 0; color: var(--title-text);
|
| 361 |
-
}}
|
| 362 |
-
|
| 363 |
-
/* Optional: smaller top blank textinput (st.text_input label) */
|
| 364 |
-
label[for="user_input"] + div input {{ background: #fff; }}
|
| 365 |
-
|
| 366 |
-
</style>", unsafe_allow_html=True)
|
| 367 |
-
|
| 368 |
|
| 369 |
def page_header(title: str, subtitle: str | None = None, icon: str | None = None) -> None:
|
| 370 |
ico = f"<span style='font-size:26px;margin-right:8px'>{icon}</span>" if icon else ""
|
| 371 |
sub = f"<div style='color:var(--brand-muted);margin-top:4px'>{subtitle}</div>" if subtitle else ""
|
| 372 |
st.markdown(
|
| 373 |
f"<div style='margin-bottom:10px'><div style='font-weight:800;font-size:26px'>{ico}{title}</div>{sub}</div>",
|
| 374 |
-
unsafe_allow_html=True
|
| 375 |
)
|
| 376 |
|
| 377 |
-
def card_start():
|
| 378 |
st.markdown("<div class='card'>", unsafe_allow_html=True)
|
| 379 |
|
| 380 |
-
def card_end():
|
| 381 |
st.markdown("</div>", unsafe_allow_html=True)
|
|
|
|
| 1 |
# src/brand.py
|
| 2 |
from __future__ import annotations
|
| 3 |
import streamlit as st
|
| 4 |
+
from string import Template
|
| 5 |
+
|
| 6 |
+
# Brand palette
|
| 7 |
+
PRIMARY = "#2563EB" # Indigo 600
|
| 8 |
+
PRIMARY_DARK = "#1E40AF" # Indigo 800
|
| 9 |
+
PRIMARY_700 = "#1B2F7A"
|
| 10 |
+
SUCCESS = "#10B981" # Emerald 500
|
| 11 |
+
WARNING = "#F59E0B" # Amber 500
|
| 12 |
+
DANGER = "#DC2626" # Red 600
|
| 13 |
+
TEXT = "#111827" # Gray 900
|
| 14 |
+
MUTED = "#6B7280" # Gray 500
|
| 15 |
+
PAGE_BG = "#F7F8FB"
|
| 16 |
+
CARD_BG = "#FFFFFF"
|
| 17 |
+
CARD_BORDER = "#E7E9F1"
|
| 18 |
|
| 19 |
def inject_brand_css() -> None:
|
| 20 |
+
"""Inject brand/theme CSS once per run (safe to call multiple times)."""
|
| 21 |
+
css_tpl = Template("""
|
| 22 |
<style>
|
| 23 |
+
:root {
|
| 24 |
+
--brand-primary: $PRIMARY;
|
| 25 |
+
--brand-primary-dark: $PRIMARY_DARK;
|
| 26 |
+
--brand-primary-700: $PRIMARY_700;
|
| 27 |
+
--brand-success: $SUCCESS;
|
| 28 |
+
--brand-warning: $WARNING;
|
| 29 |
+
--brand-danger: $DANGER;
|
| 30 |
+
--brand-text: $TEXT;
|
| 31 |
+
--brand-muted: $MUTED;
|
| 32 |
+
--page-bg: $PAGE_BG;
|
| 33 |
+
--card-bg: $CARD_BG;
|
| 34 |
+
--card-border: $CARD_BORDER;
|
| 35 |
+
|
| 36 |
+
--radius-lg: 14px;
|
| 37 |
+
--radius-md: 10px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
--shadow-sm: 0 4px 14px rgba(15, 23, 42, .06);
|
| 39 |
--shadow-md: 0 10px 30px rgba(15, 23, 42, .08);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
+
--ink-900:#0F172A; --ink-700:#334155; --ink-500:#64748B;
|
| 42 |
+
--bubble-user:#E8F1FF; --bubble-bot:#E9FAF2;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
html, body { background: var(--page-bg) !important; }
|
| 46 |
+
.block-container { padding-top: 1.2rem !important; }
|
| 47 |
+
|
| 48 |
+
/* ---------- Tabs Shell ---------- */
|
| 49 |
+
[data-baseweb="tab-list"] {
|
| 50 |
+
background: var(--card-bg);
|
| 51 |
+
border: 1px solid var(--card-border);
|
| 52 |
+
border-radius: 14px;
|
| 53 |
+
box-shadow: var(--shadow-sm);
|
| 54 |
+
padding: 6px 8px;
|
| 55 |
+
margin-bottom: 18px;
|
| 56 |
+
}
|
| 57 |
+
[data-baseweb="tab"] {
|
| 58 |
+
padding: 10px 14px !important;
|
| 59 |
+
font-weight: 600;
|
| 60 |
+
color: #334155;
|
| 61 |
+
}
|
| 62 |
+
[data-baseweb="tab"][aria-selected="true"] {
|
| 63 |
+
color: var(--brand-primary) !important;
|
| 64 |
+
background: #EEF5FF;
|
| 65 |
+
border-radius: 12px;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
/* ---------- Buttons ---------- */
|
| 69 |
+
[data-testid="stButton"] > button {
|
| 70 |
+
border-radius: 12px !important;
|
| 71 |
+
font-weight: 700 !important;
|
| 72 |
+
border: none !important;
|
| 73 |
+
box-shadow: var(--shadow-sm) !important;
|
| 74 |
+
}
|
| 75 |
+
[data-testid="stButton"] > button[kind="primary"]{
|
| 76 |
+
background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-dark) 100%) !important;
|
| 77 |
color: #fff !important;
|
| 78 |
+
}
|
| 79 |
+
[data-testid="stButton"] > button[kind="primary"]:hover{
|
| 80 |
+
transform: translateY(-1px);
|
| 81 |
+
box-shadow: var(--shadow-md) !important;
|
| 82 |
+
filter: brightness(1.02);
|
| 83 |
+
}
|
| 84 |
+
[data-testid="stButton"] > button[kind="secondary"]{
|
| 85 |
+
background: #fff !important; color: var(--brand-primary) !important;
|
| 86 |
+
border: 1px solid var(--card-border) !important;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
/* ---------- Cards & Tables ---------- */
|
| 90 |
+
.card {
|
| 91 |
+
background: var(--card-bg);
|
| 92 |
+
border: 1px solid var(--card-border);
|
| 93 |
+
border-radius: var(--radius-lg);
|
| 94 |
+
box-shadow: var(--shadow-sm);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
padding: 18px;
|
| 96 |
+
}
|
| 97 |
+
[data-testid="stDataFrame"] {
|
| 98 |
+
border: 1px solid var(--card-border);
|
|
|
|
| 99 |
border-radius: 12px;
|
| 100 |
+
box-shadow: var(--shadow-sm);
|
| 101 |
+
background: var(--card-bg);
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
/* ---------- Chat Header ---------- */
|
| 105 |
+
.brand-page-wrap .chat-header {
|
| 106 |
+
display:flex; align-items:center; gap:14px; margin: 0 0 14px 0;
|
| 107 |
+
}
|
| 108 |
+
.brand-page-wrap .chat-title {
|
| 109 |
+
font-size: clamp(22px, 2.2vw, 34px);
|
| 110 |
+
font-weight:800; color: var(--ink-900);
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
/* ---------- Chat Input Card ---------- */
|
| 114 |
+
.chat-input-card {
|
| 115 |
+
background: var(--card-bg); border:1px solid var(--card-border);
|
| 116 |
+
border-radius:16px; padding:14px 16px; box-shadow: var(--shadow-sm);
|
| 117 |
+
margin-bottom:16px;
|
| 118 |
+
}
|
| 119 |
+
.chat-controls-row { display:flex; align-items:center; gap:10px; margin-top:6px; }
|
| 120 |
+
.chat-submit-btn > button {
|
| 121 |
+
width: 160px; height: 42px;
|
| 122 |
+
background: var(--brand-primary) !important;
|
| 123 |
+
color:#fff !important; border:none !important; border-radius:12px;
|
| 124 |
+
font-weight:800;
|
| 125 |
+
}
|
| 126 |
+
.chat-submit-btn > button:hover { background: var(--brand-primary-dark) !important; }
|
| 127 |
+
|
| 128 |
+
/* ---------- Conversation Stream ---------- */
|
| 129 |
+
.chat-stream { display:flex; flex-direction:column; gap:12px; }
|
| 130 |
+
.msg { border-radius:14px; padding:12px 14px; box-shadow: var(--shadow-sm); }
|
| 131 |
+
.msg-user { background: var(--bubble-user); border:1px solid #DBE7FF; }
|
| 132 |
+
.msg-bot { background: var(--bubble-bot); border:1px solid #C7F4DF; }
|
| 133 |
+
|
| 134 |
+
.msg-header{
|
| 135 |
+
display:flex; justify-content:space-between; align-items:center;
|
| 136 |
+
font-size:12px; color:#6B7280; margin-bottom:6px;
|
| 137 |
+
}
|
| 138 |
+
.msg-role{ font-weight:700; color:#0F172A; }
|
| 139 |
+
|
| 140 |
+
/* ---------- Login layout helpers (used by auth UI) ---------- */
|
| 141 |
+
.login-row { display:flex; gap:28px; }
|
| 142 |
+
.login-hero { height:620px; width:100%; }
|
| 143 |
+
.login-hero img { height:100%; width:100%; object-fit:cover; border-radius:12px; }
|
| 144 |
+
.login-card-shell { height:620px; width:100%; display:flex; align-items:center; }
|
| 145 |
+
.login-card-shell > div[data-testid="stVerticalBlock"] {
|
| 146 |
+
width:100%; display:flex; flex-direction:column; justify-content:center;
|
| 147 |
+
}
|
| 148 |
+
[data-testid="stForm"] { margin-top:0 !important; }
|
| 149 |
+
[data-testid="stForm"] input,
|
| 150 |
+
[data-testid="stForm"] textarea,
|
| 151 |
+
[data-testid="stForm"] select { border-radius:10px; }
|
| 152 |
+
[data-testid="stForm"] .stButton > button { width:100%; }
|
| 153 |
+
form [type="submit"]{
|
| 154 |
+
width:100%; height:42px; border-radius:12px; font-weight:800;
|
| 155 |
+
letter-spacing:.15px; color:#fff; border:none;
|
| 156 |
+
background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-700) 100%);
|
| 157 |
+
box-shadow: var(--shadow-sm);
|
| 158 |
+
}
|
| 159 |
+
form [type="submit"]:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
|
| 160 |
+
</style>
|
| 161 |
+
""")
|
| 162 |
+
|
| 163 |
+
css = css_tpl.substitute(
|
| 164 |
+
PRIMARY=PRIMARY, PRIMARY_DARK=PRIMARY_DARK, PRIMARY_700=PRIMARY_700,
|
| 165 |
+
SUCCESS=SUCCESS, WARNING=WARNING, DANGER=DANGER,
|
| 166 |
+
TEXT=TEXT, MUTED=MUTED, PAGE_BG=PAGE_BG,
|
| 167 |
+
CARD_BG=CARD_BG, CARD_BORDER=CARD_BORDER,
|
| 168 |
+
)
|
| 169 |
+
st.markdown(css, unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
|
| 171 |
def page_header(title: str, subtitle: str | None = None, icon: str | None = None) -> None:
|
| 172 |
ico = f"<span style='font-size:26px;margin-right:8px'>{icon}</span>" if icon else ""
|
| 173 |
sub = f"<div style='color:var(--brand-muted);margin-top:4px'>{subtitle}</div>" if subtitle else ""
|
| 174 |
st.markdown(
|
| 175 |
f"<div style='margin-bottom:10px'><div style='font-weight:800;font-size:26px'>{ico}{title}</div>{sub}</div>",
|
| 176 |
+
unsafe_allow_html=True,
|
| 177 |
)
|
| 178 |
|
| 179 |
+
def card_start() -> None:
|
| 180 |
st.markdown("<div class='card'>", unsafe_allow_html=True)
|
| 181 |
|
| 182 |
+
def card_end() -> None:
|
| 183 |
st.markdown("</div>", unsafe_allow_html=True)
|