Spaces:
Running

agosto / estilo.py
andervier's picture
Descarga con dos botones y totales del Excel como números
5080d89 verified
Raw History Blame Contribute Delete
19.7 kB
"""Estilo visual de la app: cristal translúcido como las ventanas de Windows 7 (Aero), con sus botones
de degradado brillante. Solo es CSS: no cambia ningún comportamiento."""
import streamlit as st
CSS = """
<style>
/* ---------- tipografía y colores base ---------- */
/* Streamlit fija su fuente en cada elemento: se reemplaza en todos menos en los iconos y el código */
[data-testid="stApp"] *:not([data-testid="stIconMaterial"]):not(code):not(pre):not(pre *) {
font-family: "Segoe UI", "Segoe UI Web", Tahoma, "Helvetica Neue", Arial, sans-serif !important;
}
:root {
--aero-titulo: #1e3287;
--aero-texto: #1b1b1b;
--aero-borde-panel: #a5bdd8;
--aero-sombra: 0 1px 3px rgba(0, 30, 70, .18);
}
/* ---------- fondo de escritorio: familia Pantone 643 C / 644 C / 645 C (azul grisáceo suave) ----------
Equivalencias aproximadas en pantalla: 643 C ≈ #C6D6E3 (principal), 644 C ≈ #9BB8D3, 645 C ≈ #779FB5 (bordes,
para que el cristal de las ventanas se siga distinguiendo del fondo). */
:root {
--pantone-643c: #c6d6e3;
--pantone-644c: #9bb8d3;
--pantone-645c: #779fb5;
}
[data-testid="stApp"] {
background:
radial-gradient(ellipse 60% 50% at 15% 10%, rgba(255, 255, 255, .55), transparent 70%),
radial-gradient(ellipse 50% 60% at 88% 92%, rgba(119, 159, 181, .55), transparent 70%),
linear-gradient(160deg, var(--pantone-644c) 0%, var(--pantone-643c) 35%, #d6e2eb 55%,
var(--pantone-643c) 75%, var(--pantone-645c) 100%);
background-attachment: fixed;
}
[data-testid="stApp"]::before { /* destellos diagonales del fondo de Windows 7 */
content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
background:
linear-gradient(118deg, transparent 32%, rgba(255, 255, 255, .22) 42%, transparent 52%),
linear-gradient(104deg, transparent 58%, rgba(255, 255, 255, .14) 66%, transparent 76%);
}
[data-testid="stHeader"] { background: transparent; }
[data-testid="stDecoration"] { display: none; }
[data-testid="stStatusWidget"] { display: none; } /* el estado lo muestra el agente */
/* ---------- ventanas de cristal ---------- */
[data-testid="stMainBlockContainer"] {
background: linear-gradient(180deg, rgba(255, 255, 255, .50) 0%, rgba(214, 233, 250, .34) 120px,
rgba(214, 233, 250, .30) 100%);
backdrop-filter: blur(18px) saturate(160%);
-webkit-backdrop-filter: blur(18px) saturate(160%);
border: 1px solid rgba(255, 255, 255, .78);
border-radius: 10px;
box-shadow:
0 0 0 1px rgba(8, 38, 78, .45),
inset 0 1px 0 rgba(255, 255, 255, .95),
inset 0 0 22px rgba(255, 255, 255, .28),
0 14px 44px rgba(0, 22, 58, .50);
margin: 3.2rem auto 2.5rem;
width: calc(100% - 3rem) !important;
padding: 1.6rem 2.2rem 2.4rem !important;
max-width: 1500px;
}
[data-testid="stSidebar"] {
background: linear-gradient(180deg, rgba(240, 247, 255, .72) 0%, rgba(205, 226, 247, .58) 100%) !important;
backdrop-filter: blur(20px) saturate(160%);
-webkit-backdrop-filter: blur(20px) saturate(160%);
border-right: 1px solid rgba(255, 255, 255, .85);
box-shadow: inset -1px 0 0 rgba(8, 38, 78, .35), 6px 0 26px rgba(0, 22, 58, .35);
}
[data-testid="stSidebar"] > div:first-child,
[data-testid="stSidebarContent"] { background: transparent !important; }
/* ---------- títulos: texto oscuro con el halo blanco de las barras de título ---------- */
[data-testid="stApp"] h1 {
color: #0f2340; font-weight: 400; letter-spacing: -.01em;
text-shadow: 0 0 14px rgba(255, 255, 255, .95), 0 0 4px rgba(255, 255, 255, .9);
}
[data-testid="stApp"] h2, [data-testid="stApp"] h3 {
color: var(--aero-titulo); font-weight: 400;
text-shadow: 0 0 10px rgba(255, 255, 255, .9);
}
[data-testid="stCaptionContainer"], [data-testid="stCaptionContainer"] p { color: #22364f !important; }
[data-testid="stWidgetLabel"] p { color: #10233c; }
/* ---------- paneles blancos (la "zona de trabajo" de cada ventana) ---------- */
[data-testid="stExpander"] details {
background: rgba(255, 255, 255, .90);
border: 1px solid var(--aero-borde-panel) !important;
border-radius: 6px;
box-shadow: inset 0 1px 0 #fff, var(--aero-sombra);
}
[data-testid="stExpander"] summary {
background: linear-gradient(180deg, #fdfeff 0%, #f0f6fd 48%, #e1ecf8 52%, #eaf2fb 100%);
border-radius: 6px;
color: var(--aero-titulo) !important;
}
[data-testid="stExpander"] details[open] > summary {
border-bottom: 1px solid #c9d8ea; border-radius: 6px 6px 0 0;
}
[data-testid="stExpander"] summary:hover { background: linear-gradient(180deg, #f4faff 0%, #e3f1fd 48%, #cfe6fb 52%, #dbedfc 100%); }
[data-testid="stFileUploaderDropzone"] {
background: rgba(255, 255, 255, .88) !important;
border: 1px solid var(--aero-borde-panel) !important;
border-radius: 5px;
box-shadow: inset 0 1px 2px rgba(0, 30, 70, .10);
}
[data-testid="stDataFrame"], [data-testid="stDataFrameResizable"] {
background: #fff;
border-radius: 4px;
box-shadow: 0 0 0 1px var(--aero-borde-panel), var(--aero-sombra);
}
[data-testid="stMetric"] {
background: linear-gradient(180deg, rgba(255, 255, 255, .95) 0%, rgba(240, 247, 254, .92) 100%);
border: 1px solid var(--aero-borde-panel);
border-radius: 6px;
padding: .55rem .9rem;
box-shadow: inset 0 1px 0 #fff, var(--aero-sombra);
}
[data-testid="stMetricValue"] { color: var(--aero-titulo); }
/* ---------- avisos: barras de información de Windows 7 ---------- */
[data-testid="stAlertContainer"] {
border-radius: 5px;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), var(--aero-sombra);
color: var(--aero-texto) !important;
}
[data-testid="stAlertContentInfo"], [data-testid="stAlertContentSuccess"],
[data-testid="stAlertContentWarning"], [data-testid="stAlertContentError"] { color: var(--aero-texto) !important; }
[data-testid="stAlertContainer"]:has([data-testid="stAlertContentInfo"]) {
background: linear-gradient(180deg, #f5faff 0%, #e4f0fc 100%) !important; border: 1px solid #a6c8ef; }
[data-testid="stAlertContainer"]:has([data-testid="stAlertContentSuccess"]) {
background: linear-gradient(180deg, #f3fbf3 0%, #e0f3e1 100%) !important; border: 1px solid #9fd3a5; }
[data-testid="stAlertContainer"]:has([data-testid="stAlertContentWarning"]) {
background: linear-gradient(180deg, #fffdf0 0%, #fff4c9 100%) !important; border: 1px solid #e3c96c; }
[data-testid="stAlertContainer"]:has([data-testid="stAlertContentError"]) {
background: linear-gradient(180deg, #fff6f6 0%, #fbe1e1 100%) !important; border: 1px solid #e0a0a0; }
/* ---------- cuadros de texto y listas: borde fino gris que se vuelve azul al enfocar ---------- */
[data-baseweb="input"], [data-baseweb="textarea"], [data-baseweb="select"] > div, [data-baseweb="base-input"] {
background: #fff !important;
border-radius: 2px !important;
}
[data-baseweb="input"], [data-baseweb="textarea"], [data-baseweb="select"] > div {
border: 1px solid !important;
border-color: #abadb3 #dbdfe6 #e3e9ef #e2e3ea !important;
}
[data-baseweb="input"]:hover, [data-baseweb="textarea"]:hover, [data-baseweb="select"] > div:hover {
border-color: #5794bf #b7d5ea #c7e2f1 #c5daed !important;
}
[data-baseweb="input"]:focus-within, [data-baseweb="textarea"]:focus-within, [data-baseweb="select"] > div:focus-within {
border-color: #3d7bad #a4c9e3 #b7d9ed #b5cfe7 !important;
box-shadow: none !important;
}
/* ---------- botones con el brillo de Windows 7 ---------- */
[data-testid^="stBaseButton"] {
background: linear-gradient(180deg, #f6f6f6 0%, #ececec 48%, #dcdcdc 52%, #d0d0d0 100%) !important;
border: 1px solid #707070 !important;
border-radius: 3px !important;
color: #000 !important;
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .75) !important;
font-weight: 400 !important;
min-height: 2rem;
padding: .25rem 1.1rem !important;
transition: background .15s, border-color .15s, box-shadow .15s;
}
[data-testid^="stBaseButton"]:hover {
background: linear-gradient(180deg, #eaf6fd 0%, #d9f0fc 48%, #bee6fd 52%, #a7d9f5 100%) !important;
border-color: #3c7fb1 !important;
color: #000 !important;
}
[data-testid^="stBaseButton"]:active {
background: linear-gradient(180deg, #e5f4fc 0%, #c4e5f6 48%, #98d1ef 52%, #68b3db 100%) !important;
border-color: #2c628b !important;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35) !important;
}
[data-testid^="stBaseButton"]:focus-visible { outline: 1px dotted #000 !important; outline-offset: -4px; }
[data-testid^="stBaseButton"]:disabled { background: #f4f4f4 !important; border-color: #adb2b5 !important; color: #838383 !important; }
/* botón principal: azul brillante, como los botones destacados de Aero */
[data-testid="stBaseButton-primary"], [data-testid="stBaseButton-primaryFormSubmit"] {
background: linear-gradient(180deg, #9bd0fa 0%, #4fa3ec 47%, #1e72d0 53%, #3a90e3 100%) !important;
border: 1px solid #154e91 !important;
color: #fff !important;
text-shadow: 0 1px 1px rgba(0, 25, 70, .55);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65), inset 0 0 0 1px rgba(255, 255, 255, .22),
0 1px 2px rgba(0, 30, 80, .35) !important;
}
[data-testid="stBaseButton-primary"]:hover, [data-testid="stBaseButton-primaryFormSubmit"]:hover {
background: linear-gradient(180deg, #b5ddfc 0%, #65b3f2 47%, #2d84df 53%, #4ea2ee 100%) !important;
border-color: #0f4685 !important;
color: #fff !important;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 0 10px rgba(120, 205, 255, .95) !important;
}
[data-testid="stBaseButton-primary"]:active, [data-testid="stBaseButton-primaryFormSubmit"]:active {
background: linear-gradient(180deg, #4b95dc 0%, #2a75c6 47%, #145aa8 53%, #2068b8 100%) !important;
}
/* ---------- el agente ---------- */
.ag-panel {
background: linear-gradient(180deg, rgba(255, 255, 255, .93) 0%, rgba(236, 245, 254, .90) 100%);
border: 1px solid var(--aero-borde-panel);
border-radius: 8px;
box-shadow: inset 0 1px 0 #fff, 0 2px 10px rgba(0, 30, 70, .20);
padding: 12px 18px 14px;
margin-bottom: .6rem;
}
.ag-cab { display: flex; align-items: center; gap: 14px; }
.ag-nombre { font-size: 1.7rem; line-height: 1.1; color: #0f2340; }
.ag-rol { font-size: .88rem; color: #45607e; display: flex; align-items: center; gap: 6px; }
.ag-led { width: 9px; height: 9px; border-radius: 50%; display: inline-block;
box-shadow: inset 0 1px 1px rgba(255, 255, 255, .8), 0 0 0 1px rgba(0, 0, 0, .25); }
.ag-led-reposo, .ag-led-listo { background: radial-gradient(circle at 35% 35%, #c9ffd0, #2fb24a); }
.ag-led-pensando { background: radial-gradient(circle at 35% 35%, #d6f1ff, #2a8be0); animation: ag-titila .8s infinite; }
.ag-led-atencion { background: radial-gradient(circle at 35% 35%, #fff2c4, #e3a10f); animation: ag-titila 1.4s infinite; }
.ag-ocultos { font-size: .78rem; color: #5a7290; margin: 8px 0 0 46px; }
.ag-chat { display: flex; flex-direction: column-reverse; gap: 8px; margin-top: 10px; max-height: 380px; overflow-y: auto; padding-right: 4px; }
.ag-chat-completo { max-height: none; flex-direction: column; }
.ag-msg { display: flex; gap: 8px; align-items: flex-end; }
.ag-de-usuario { justify-content: flex-end; }
.ag-burbuja { max-width: 80%; padding: 8px 13px; border-radius: 11px; line-height: 1.45; font-size: .94rem; }
.ag-burbuja ul { margin: 4px 0 2px; padding-left: 20px; }
.ag-burbuja li { margin: 1px 0; }
.ag-de-agente .ag-burbuja { background: #fff; border: 1px solid #c5d6ea; border-bottom-left-radius: 3px;
box-shadow: 0 1px 2px rgba(0, 30, 70, .12); color: #1b1b1b; }
.ag-de-usuario .ag-burbuja { background: linear-gradient(180deg, #ebf6ff 0%, #d2e7fb 100%); border: 1px solid #9cc3ea;
border-bottom-right-radius: 3px; color: #10233c; }
.ag-nueva { animation: ag-entra .4s ease-out; }
.ag-trabajando { min-width: 260px; }
.ag-paso { position: relative; padding: 1px 0 1px 22px; color: #22364f; }
.ag-paso.hecho::before { content: ""; position: absolute; left: 6px; top: .3em; width: 5px; height: 10px;
border: solid #2e8b3e; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.ag-paso.actual { color: #0f2340; font-weight: 600; }
.ag-paso.actual::before { content: ""; position: absolute; left: 2px; top: .32em; width: 9px; height: 9px; border-radius: 50%;
border: 2px solid #b8d6f3; border-top-color: #2a76c6; animation: ag-gira .8s linear infinite; }
.ag-paso.aviso { color: #8a5a00; }
.ag-paso.aviso::before { content: "!"; position: absolute; left: 5px; top: 0; font-weight: 700; color: #c98a00; }
.ag-puntos i { display: inline-block; width: 4px; height: 4px; margin-left: 3px; border-radius: 50%;
background: #2a76c6; animation: ag-salta 1s infinite; }
.ag-puntos i:nth-child(2) { animation-delay: .15s; }
.ag-puntos i:nth-child(3) { animation-delay: .3s; }
/* avatar: orbe de cristal con cara. Cada estado tiene su expresión y su movimiento */
.ag-orbe { overflow: visible; flex: none; filter: drop-shadow(0 4px 8px rgba(0, 30, 80, .35)); color: #8fd8ff; }
.ag-orbe .ag-flota { transform-origin: 50px 80px; animation: ag-flota 3.6s ease-in-out infinite; }
.ag-orbe .ag-cuerpo { transform-origin: 50px 50px; animation: ag-respira 4s ease-in-out infinite; }
.ag-orbe .ag-halo { transform-origin: 50px 50px; animation: ag-halo 4s ease-in-out infinite; }
.ag-orbe .ag-ojos { transform-origin: 50px 49px; animation: ag-parpadeo 5.5s infinite; }
.ag-orbe .ag-anillos { transform-origin: 50px 50px; opacity: .3; animation: ag-gira 22s linear infinite; }
.ag-orbe .ag-chispas { transform-origin: 50px 50px; opacity: 0; }
/* en reposo: de vez en cuando mira a los lados */
.ag-reposo .ag-cara { animation: ag-curiosea 9s ease-in-out infinite; }
/* pensando: mira hacia arriba de un lado a otro, levanta una ceja y ladea la cabeza */
.ag-pensando { color: #6fdcff; }
.ag-pensando .ag-anillos { opacity: 1; animation-duration: 2.2s; }
.ag-pensando .ag-chispas { opacity: 1; animation: ag-gira 1.5s linear infinite reverse; }
.ag-pensando .ag-halo { animation-duration: 1.1s; }
.ag-pensando .ag-cuerpo { animation: ag-ladea 2.6s ease-in-out infinite; }
.ag-pensando .ag-cara { animation: ag-piensa 2.6s ease-in-out infinite; }
.ag-pensando .ag-ojos { animation: none; }
.ag-pensando .ag-ceja-d { transform-origin: 59px 35px; animation: ag-ceja 1.3s ease-in-out infinite; }
/* listo: ojos felices, sonrisa, rubor, un saltito y destellos */
.ag-listo { color: #8ef0a0; }
.ag-listo .ag-flota { animation: ag-brinca 2.8s ease-in-out infinite; }
.ag-listo .ag-chispas { animation: ag-destella 2.8s ease-out infinite; }
.ag-listo .ag-halo { animation-duration: 2.8s; }
/* necesita revisión: cejas preocupadas, se tambalea y aparece un «!» */
.ag-atencion { color: #ffd25e; }
.ag-atencion .ag-halo { animation-duration: 1.6s; }
.ag-atencion .ag-cuerpo { animation: ag-duda 3.2s ease-in-out infinite; }
.ag-atencion .ag-exclama { transform-origin: 83px 26px; animation: ag-exclama 1.6s ease-in-out infinite; }
/* avatares chicos de la conversación: misma cara, movimientos más discretos */
.ag-mini { filter: drop-shadow(0 1px 3px rgba(0, 30, 80, .3)); }
.ag-mini .ag-anillos, .ag-mini .ag-chispas { display: none; }
.ag-mini .ag-halo { opacity: .5; animation: none; }
.ag-mini .ag-flota, .ag-mini .ag-cuerpo, .ag-mini .ag-cara { animation-duration: 6s; }
@keyframes ag-flota { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.8px); } }
@keyframes ag-respira { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes ag-halo { 0%, 100% { opacity: .55; transform: scale(.93); } 50% { opacity: 1; transform: scale(1.05); } }
@keyframes ag-parpadeo { 0%, 86%, 90%, 94%, 100% { transform: scaleY(1); } 88%, 92% { transform: scaleY(.1); } }
@keyframes ag-curiosea {
0%, 38%, 74%, 100% { transform: translate(0, 0); }
44%, 54% { transform: translate(-3px, .6px); }
60%, 68% { transform: translate(3px, -.6px); }
}
@keyframes ag-piensa { 0%, 100% { transform: translate(2.5px, -1.2px); } 50% { transform: translate(-2.5px, -1.6px); } }
@keyframes ag-ladea { 0%, 100% { transform: rotate(-4deg) scale(1.01); } 50% { transform: rotate(4deg) scale(1.03); } }
@keyframes ag-ceja { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.6px); } }
@keyframes ag-brinca {
0%, 58%, 100% { transform: translateY(0) scale(1, 1); }
64% { transform: translateY(1px) scale(1.06, .93); }
74% { transform: translateY(-8px) scale(.96, 1.05); }
84% { transform: translateY(0) scale(1.04, .96); }
90% { transform: translateY(0) scale(1, 1); }
}
@keyframes ag-destella {
0%, 62% { opacity: 0; transform: scale(.75); }
76% { opacity: 1; transform: scale(1); }
100% { opacity: 0; transform: scale(1.18) rotate(25deg); }
}
@keyframes ag-duda {
0%, 52%, 100% { transform: rotate(0); }
60% { transform: rotate(-7deg); }
68% { transform: rotate(6deg); }
76% { transform: rotate(-3deg); }
84% { transform: rotate(0); }
}
@keyframes ag-exclama { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-3px) rotate(9deg); } }
@keyframes ag-gira { to { transform: rotate(360deg); } }
@keyframes ag-titila { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes ag-salta { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-4px); opacity: 1; } }
@keyframes ag-entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
.ag-orbe *, .ag-nueva, .ag-led, .ag-puntos i, .ag-paso::before { animation: none !important; }
}
/* caja de chat fija abajo */
[data-testid="stBottom"] > div, [data-testid="stBottomBlockContainer"] { background: transparent !important; }
[data-testid="stChatInput"] {
background: rgba(255, 255, 255, .92) !important;
border: 1px solid #8fb3da !important;
border-radius: 8px !important;
box-shadow: inset 0 1px 0 #fff, 0 4px 18px rgba(0, 25, 60, .35) !important;
}
[data-testid="stChatInput"] textarea { color: #10233c !important; }
/* enlace de descarga del Excel, con el aspecto del botón principal */
a.boton-descarga {
display: inline-block; padding: .4rem 1.3rem; border-radius: 3px; text-decoration: none !important;
color: #fff !important; text-shadow: 0 1px 1px rgba(0, 25, 70, .55);
background: linear-gradient(180deg, #9bd0fa 0%, #4fa3ec 47%, #1e72d0 53%, #3a90e3 100%);
border: 1px solid #154e91;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65), 0 1px 2px rgba(0, 30, 80, .35);
}
a.boton-descarga:hover {
background: linear-gradient(180deg, #b5ddfc 0%, #65b3f2 47%, #2d84df 53%, #4ea2ee 100%);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 0 10px rgba(120, 205, 255, .95);
}
/* el segundo formato de descarga, con el aspecto de un botón normal */
a.boton-descarga.boton-secundario {
color: #1f2937 !important; text-shadow: none;
background: linear-gradient(180deg, #fbfcfe 0%, #eef2f7 47%, #e1e8f0 53%, #eaf0f6 100%);
border: 1px solid #8fa6c0;
}
a.boton-descarga.boton-secundario:hover {
background: linear-gradient(180deg, #ffffff 0%, #f3f7fb 47%, #e8eff7 53%, #f1f6fb 100%);
}
/* ---------- pestañas del registro ---------- */
[data-baseweb="tab-list"] { gap: 2px; border-bottom: 1px solid #a5bdd8; }
[data-baseweb="tab-list"] button[role="tab"] {
background: linear-gradient(180deg, #fbfcfe 0%, #e9f0f8 100%);
border: 1px solid #a5bdd8; border-bottom: none; border-radius: 4px 4px 0 0;
padding: .3rem .9rem;
}
[data-baseweb="tab-list"] button[role="tab"][aria-selected="true"] { background: #fff; }
[data-baseweb="tab-highlight"], [data-baseweb="tab-border"] { display: none; }
</style>
"""
def aplicar_estilo():
st.markdown(CSS, unsafe_allow_html=True)