Spaces:
Running
Running
Upload app.py
Browse files
app.py
CHANGED
|
@@ -806,46 +806,134 @@ def inject_css():
|
|
| 806 |
}
|
| 807 |
|
| 808 |
/* ============================================
|
| 809 |
-
MOBILE RESPONSIVE
|
| 810 |
============================================ */
|
| 811 |
@media (max-width: 768px) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 812 |
.fx-topnav {
|
| 813 |
-
padding: 0.
|
| 814 |
flex-wrap: wrap !important;
|
| 815 |
-
gap: 0.
|
| 816 |
min-height: 40px !important;
|
| 817 |
}
|
| 818 |
.fx-topnav .fx-brand {
|
| 819 |
-
font-size: 0.
|
| 820 |
}
|
| 821 |
.fx-topnav-right {
|
| 822 |
-
gap: 0.
|
| 823 |
}
|
| 824 |
.fx-topnav-right .status-badge {
|
| 825 |
display: none !important;
|
| 826 |
}
|
| 827 |
-
|
| 828 |
-
|
| 829 |
-
|
| 830 |
-
|
| 831 |
-
|
| 832 |
}
|
| 833 |
-
.
|
| 834 |
-
font-size:
|
| 835 |
}
|
|
|
|
|
|
|
| 836 |
.fx-card {
|
| 837 |
-
padding: 0.
|
|
|
|
| 838 |
}
|
| 839 |
.fx-card-value {
|
| 840 |
font-size: 1.2rem !important;
|
| 841 |
}
|
| 842 |
-
|
| 843 |
-
|
|
|
|
|
|
|
|
|
|
| 844 |
}
|
| 845 |
-
.
|
| 846 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 847 |
}
|
| 848 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 849 |
[data-testid="collapsedControl"] {
|
| 850 |
display: flex !important;
|
| 851 |
visibility: visible !important;
|
|
@@ -854,7 +942,7 @@ def inject_css():
|
|
| 854 |
top: 60px !important;
|
| 855 |
left: 0 !important;
|
| 856 |
z-index: 99999 !important;
|
| 857 |
-
background: #
|
| 858 |
border-radius: 0 8px 8px 0 !important;
|
| 859 |
padding: 10px 5px !important;
|
| 860 |
width: 24px !important;
|
|
@@ -864,21 +952,32 @@ def inject_css():
|
|
| 864 |
fill: white !important;
|
| 865 |
}
|
| 866 |
|
| 867 |
-
|
| 868 |
-
|
| 869 |
-
|
| 870 |
}
|
| 871 |
-
|
| 872 |
-
[data-testid="stDataFrame"] {
|
| 873 |
-
overflow-x: auto !important;
|
| 874 |
font-size: 0.6rem !important;
|
| 875 |
}
|
|
|
|
|
|
|
|
|
|
| 876 |
|
| 877 |
-
|
| 878 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 879 |
}
|
| 880 |
|
| 881 |
-
|
|
|
|
| 882 |
padding: 0.4rem 0.8rem !important;
|
| 883 |
font-size: 0.7rem !important;
|
| 884 |
}
|
|
@@ -1284,6 +1383,43 @@ def topnav():
|
|
| 1284 |
<style>@keyframes fxPulse{{0%,100%{{opacity:1}}50%{{opacity:0.4}}}}</style>
|
| 1285 |
""", unsafe_allow_html=True)
|
| 1286 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1287 |
|
| 1288 |
# ============================================
|
| 1289 |
# SIDEBAR — REDESIGNED WITH CUSTOM COLLAPSE
|
|
|
|
| 806 |
}
|
| 807 |
|
| 808 |
/* ============================================
|
| 809 |
+
MOBILE RESPONSIVE — FULL REDESIGN
|
| 810 |
============================================ */
|
| 811 |
@media (max-width: 768px) {
|
| 812 |
+
/* Hide sidebar by default on mobile */
|
| 813 |
+
section[data-testid="stSidebar"] {
|
| 814 |
+
width: 100vw !important;
|
| 815 |
+
max-width: 100vw !important;
|
| 816 |
+
position: fixed !important;
|
| 817 |
+
z-index: 10000 !important;
|
| 818 |
+
height: 100vh !important;
|
| 819 |
+
}
|
| 820 |
+
|
| 821 |
+
/* Main content full width */
|
| 822 |
+
.main > div {
|
| 823 |
+
padding: 0 0.5rem !important;
|
| 824 |
+
}
|
| 825 |
+
div[data-testid="stAppViewContainer"] {
|
| 826 |
+
margin-left: 0 !important;
|
| 827 |
+
}
|
| 828 |
+
|
| 829 |
+
/* Top nav compact */
|
| 830 |
.fx-topnav {
|
| 831 |
+
padding: 0.3rem 0.5rem !important;
|
| 832 |
flex-wrap: wrap !important;
|
| 833 |
+
gap: 0.2rem !important;
|
| 834 |
min-height: 40px !important;
|
| 835 |
}
|
| 836 |
.fx-topnav .fx-brand {
|
| 837 |
+
font-size: 0.75rem !important;
|
| 838 |
}
|
| 839 |
.fx-topnav-right {
|
| 840 |
+
gap: 0.2rem !important;
|
| 841 |
}
|
| 842 |
.fx-topnav-right .status-badge {
|
| 843 |
display: none !important;
|
| 844 |
}
|
| 845 |
+
|
| 846 |
+
/* Greeting header compact */
|
| 847 |
+
.greeting-header {
|
| 848 |
+
padding: 0.6rem !important;
|
| 849 |
+
margin-bottom: 0.5rem !important;
|
| 850 |
}
|
| 851 |
+
.greeting-header h1 {
|
| 852 |
+
font-size: 1rem !important;
|
| 853 |
}
|
| 854 |
+
|
| 855 |
+
/* Cards stack vertically */
|
| 856 |
.fx-card {
|
| 857 |
+
padding: 0.5rem !important;
|
| 858 |
+
margin-bottom: 0.3rem !important;
|
| 859 |
}
|
| 860 |
.fx-card-value {
|
| 861 |
font-size: 1.2rem !important;
|
| 862 |
}
|
| 863 |
+
|
| 864 |
+
/* Columns wrap on mobile */
|
| 865 |
+
.stColumns, [data-testid="stHorizontalBlock"] {
|
| 866 |
+
flex-wrap: wrap !important;
|
| 867 |
+
gap: 0.3rem !important;
|
| 868 |
}
|
| 869 |
+
.stColumns > div, [data-testid="stHorizontalBlock"] > div {
|
| 870 |
+
flex: 1 1 100% !important;
|
| 871 |
+
min-width: 100% !important;
|
| 872 |
+
max-width: 100% !important;
|
| 873 |
+
margin-bottom: 0.3rem !important;
|
| 874 |
+
}
|
| 875 |
+
|
| 876 |
+
/* 2-column layouts become 2 per row */
|
| 877 |
+
@media (min-width: 480px) {
|
| 878 |
+
.stColumns > div, [data-testid="stHorizontalBlock"] > div {
|
| 879 |
+
flex: 1 1 48% !important;
|
| 880 |
+
min-width: 48% !important;
|
| 881 |
+
max-width: 48% !important;
|
| 882 |
+
}
|
| 883 |
}
|
| 884 |
|
| 885 |
+
/* 3+ column layouts become 2 per row */
|
| 886 |
+
[data-testid="stHorizontalBlock"]:has(> div:nth-child(3)) > div {
|
| 887 |
+
flex: 1 1 48% !important;
|
| 888 |
+
min-width: 48% !important;
|
| 889 |
+
max-width: 48% !important;
|
| 890 |
+
}
|
| 891 |
+
|
| 892 |
+
/* 6-column KPIs become 3 per row */
|
| 893 |
+
[data-testid="stHorizontalBlock"]:has(> div:nth-child(6)) > div {
|
| 894 |
+
flex: 1 1 30% !important;
|
| 895 |
+
min-width: 30% !important;
|
| 896 |
+
max-width: 30% !important;
|
| 897 |
+
}
|
| 898 |
+
|
| 899 |
+
/* Tables scroll horizontally */
|
| 900 |
+
[data-testid="stDataFrame"] {
|
| 901 |
+
overflow-x: auto !important;
|
| 902 |
+
font-size: 0.6rem !important;
|
| 903 |
+
}
|
| 904 |
+
[data-testid="stDataFrame"] table {
|
| 905 |
+
min-width: 600px !important;
|
| 906 |
+
}
|
| 907 |
+
|
| 908 |
+
/* Buttons full width */
|
| 909 |
+
.stButton > button {
|
| 910 |
+
padding: 0.5rem 0.8rem !important;
|
| 911 |
+
font-size: 0.7rem !important;
|
| 912 |
+
width: 100% !important;
|
| 913 |
+
}
|
| 914 |
+
|
| 915 |
+
/* Tabs scrollable */
|
| 916 |
+
.stTabs [data-baseweb="tab-list"] {
|
| 917 |
+
overflow-x: auto !important;
|
| 918 |
+
flex-wrap: nowrap !important;
|
| 919 |
+
gap: 0.1rem !important;
|
| 920 |
+
padding: 0.15rem !important;
|
| 921 |
+
}
|
| 922 |
+
.stTabs [data-baseweb="tab"] {
|
| 923 |
+
padding: 0.4rem 0.6rem !important;
|
| 924 |
+
font-size: 0.65rem !important;
|
| 925 |
+
white-space: nowrap !important;
|
| 926 |
+
flex-shrink: 0 !important;
|
| 927 |
+
}
|
| 928 |
+
|
| 929 |
+
/* Forms compact */
|
| 930 |
+
.stTextInput input, .stSelectbox select, .stTextArea textarea {
|
| 931 |
+
font-size: 0.8rem !important;
|
| 932 |
+
padding: 0.4rem 0.6rem !important;
|
| 933 |
+
min-height: 38px !important;
|
| 934 |
+
}
|
| 935 |
+
|
| 936 |
+
/* Sidebar collapse button visible */
|
| 937 |
[data-testid="collapsedControl"] {
|
| 938 |
display: flex !important;
|
| 939 |
visibility: visible !important;
|
|
|
|
| 942 |
top: 60px !important;
|
| 943 |
left: 0 !important;
|
| 944 |
z-index: 99999 !important;
|
| 945 |
+
background: #CC0000 !important;
|
| 946 |
border-radius: 0 8px 8px 0 !important;
|
| 947 |
padding: 10px 5px !important;
|
| 948 |
width: 24px !important;
|
|
|
|
| 952 |
fill: white !important;
|
| 953 |
}
|
| 954 |
|
| 955 |
+
/* Metric cards smaller */
|
| 956 |
+
[data-testid="stMetric"] {
|
| 957 |
+
padding: 0.3rem !important;
|
| 958 |
}
|
| 959 |
+
[data-testid="stMetric"] label {
|
|
|
|
|
|
|
| 960 |
font-size: 0.6rem !important;
|
| 961 |
}
|
| 962 |
+
[data-testid="stMetricValue"] {
|
| 963 |
+
font-size: 1rem !important;
|
| 964 |
+
}
|
| 965 |
|
| 966 |
+
/* Calendar adjustments */
|
| 967 |
+
.cg {
|
| 968 |
+
grid-template-columns: 1fr 1fr !important;
|
| 969 |
+
gap: 5px !important;
|
| 970 |
+
}
|
| 971 |
+
.cm {
|
| 972 |
+
font-size: 0.6rem !important;
|
| 973 |
+
}
|
| 974 |
+
.ct td {
|
| 975 |
+
height: 22px !important;
|
| 976 |
+
font-size: 0.5rem !important;
|
| 977 |
}
|
| 978 |
|
| 979 |
+
/* Expanders full width */
|
| 980 |
+
.streamlit-expanderHeader {
|
| 981 |
padding: 0.4rem 0.8rem !important;
|
| 982 |
font-size: 0.7rem !important;
|
| 983 |
}
|
|
|
|
| 1383 |
<style>@keyframes fxPulse{{0%,100%{{opacity:1}}50%{{opacity:0.4}}}}</style>
|
| 1384 |
""", unsafe_allow_html=True)
|
| 1385 |
|
| 1386 |
+
# Mobile hamburger menu
|
| 1387 |
+
st.markdown("""
|
| 1388 |
+
<style>
|
| 1389 |
+
@media (max-width: 768px) {
|
| 1390 |
+
.mobile-menu-btn {
|
| 1391 |
+
display: inline-flex !important;
|
| 1392 |
+
background: #CC0000;
|
| 1393 |
+
color: white;
|
| 1394 |
+
border: none;
|
| 1395 |
+
border-radius: 6px;
|
| 1396 |
+
padding: 6px 10px;
|
| 1397 |
+
font-size: 1.2rem;
|
| 1398 |
+
cursor: pointer;
|
| 1399 |
+
position: fixed;
|
| 1400 |
+
top: 10px;
|
| 1401 |
+
right: 10px;
|
| 1402 |
+
z-index: 99999;
|
| 1403 |
+
}
|
| 1404 |
+
}
|
| 1405 |
+
@media (min-width: 769px) {
|
| 1406 |
+
.mobile-menu-btn { display: none !important; }
|
| 1407 |
+
}
|
| 1408 |
+
</style>
|
| 1409 |
+
<button class="mobile-menu-btn" onclick="
|
| 1410 |
+
var sidebar = parent.document.querySelector('[data-testid=stSidebar]');
|
| 1411 |
+
if(sidebar) {
|
| 1412 |
+
if(sidebar.style.display === 'none' || sidebar.style.transform === 'translateX(-100%)') {
|
| 1413 |
+
sidebar.style.display = 'block';
|
| 1414 |
+
sidebar.style.transform = 'translateX(0)';
|
| 1415 |
+
} else {
|
| 1416 |
+
sidebar.style.display = 'none';
|
| 1417 |
+
sidebar.style.transform = 'translateX(-100%)';
|
| 1418 |
+
}
|
| 1419 |
+
}
|
| 1420 |
+
">☰</button>
|
| 1421 |
+
""", unsafe_allow_html=True)
|
| 1422 |
+
|
| 1423 |
|
| 1424 |
# ============================================
|
| 1425 |
# SIDEBAR — REDESIGNED WITH CUSTOM COLLAPSE
|