 #card-element {
    min-height: 40px; /* Dale altura mínima */
    width: 100%;
    background: #1e293b; 
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #334155;
    margin-top: 10px;
}
        :root {
            --primary: #2563eb;
            --primary-dark: #1e40af;
            --bg: #0f172a;
            --card-bg: #1e293b;
            --text-main: #f8fafc;
            --text-dim: #94a3b8;
        }

        body {
            font-family: 'Inter', system-ui, sans-serif;
            background-color: var(--bg);
            color: var(--text-main);
            margin: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            overflow: hidden;
        }

        .container {
            width: 95%;
            max-width: 800px;
            height: 100vh;
            display: flex;
            flex-direction: column;
            padding: 10px 0;
            box-sizing: border-box;
            text-align: center;
        }

        /* Header */
        .main-header { margin-bottom: 20px; flex-shrink: 0; }
        .logo { display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; font-size: 1.5rem; font-weight: 800; }
        .logo-icon { font-size: 2rem; filter: drop-shadow(0 0 8px var(--primary)); }
        .logo-text .highlight { color: var(--primary); background: rgba(37, 99, 235, 0.1); padding: 2px 6px; border-radius: 6px; }
        .tagline { font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 2px; margin-top: 5px; }

        /* Steps */
        .steps-bar { display: flex; justify-content: space-between; margin-bottom: 20px; position: relative; flex-shrink: 0; }
        .steps-bar::before { content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 2px; background: #334155; z-index: 1; }
        .step-circle { width: 30px; height: 30px; background: var(--step-bg); border: 2px solid #334155; border-radius: 50%; display: flex; align-items: center; justify-content: center; z-index: 2; font-size: 0.8rem; transition: 0.3s; }
        .step-circle.active { border-color: var(--primary); background: var(--primary); box-shadow: 0 0 10px rgba(37, 99, 235, 0.5); }

        /* Search & Voice */
        .search-wrapper { position: relative; width: 100%; max-width: 400px; margin: 0 auto 15px; flex-shrink: 0; }
        .search-input { width: 100%; padding: 12px 45px 12px 15px; background: var(--card-bg); border: 2px solid var(--search-border); border-radius: 10px; color: var(--search-text); outline: none; box-sizing: border-box; }
        /* Para que el placeholder también cambie de color */
.search-input::placeholder {
    color: var(--search-placeholder);
}
        .voice-icon { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: transparent; border: none; cursor: pointer; font-size: 1.2rem; padding: 5px; border-radius: 50%; transition: 0.3s; color: var(--text-dim); }
        .voice-icon.active { color: #ef4444; animation: pulse-red 1.5s infinite; background: rgba(239, 68, 68, 0.1); }

        /* Recientes */
        .recientes-wrapper { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; padding: 0 10px; flex-shrink: 0; }
        .recientes-label { font-size: 0.6rem; font-weight: 800; color: var(--primary); }
        .recientes-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 5px; }
        .recientes-list::-webkit-scrollbar { display: none; }
        .reciente-item { padding: 6px 14px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; cursor: pointer; white-space: nowrap; color: white; border: 1px solid rgba(255,255,255,0.1); transition: 0.3s; text-transform: uppercase; }

        /* Grid */
        .view { display: none; flex-grow: 1; flex-direction: column; overflow: hidden; animation: fadeIn 0.3s; }
        .view.active { display: flex; }
        .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; overflow-y: auto; padding: 10px; align-content: start; }
        .item-card { background: var(--card-bg); padding: 15px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; transition: 0.2s; display: flex; flex-direction: column; align-items: center; gap: 8px; }
        .item-card:hover { border-color: var(--primary); background: #334155; transform: translateY(-2px); }
       .item-card img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    /* Usamos la variable. Si no existe, por defecto será blanco */
    filter: var(--logo-filter, brightness(0) invert(1)); 
    transition: filter 0.3s ease;
}
        /* Toast */
        .welcome-toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: var(--primary); color: white; padding: 12px 25px; border-radius: 50px; font-weight: 600; z-index: 1000; animation: slideUpFade 0.5s ease-out; display: flex; align-items: center; gap: 10px; box-shadow: 0 10px 20px rgba(0,0,0,0.3); }

        @keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }
        @keyframes slideUpFade { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }
        @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
        .overlay-inicio {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: 0.5s;
}
.btn-inicio {
    background: var(--primary);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.4);
}
/* Animación de ondas concéntricas */
.voice-icon.active::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #ef4444;
    animation: ripple 1.2s infinite;
}

@keyframes ripple {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* Color azul cuando espera y rojo cuando escucha */
.voice-icon {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.1);
}

.voice-icon.active {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.2);
}
.theme-selector {
    margin-bottom: 15px;
    font-size: 0.8rem;
    color: var(--text-dim);
}

#theme-list {
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--primary);
    padding: 5px;
    border-radius: 5px;
    outline: none;
    cursor: pointer;
      
}

/* Definición de colores por tema */
body.theme-midnight {
    --bg: #000000;
    --card-bg: #272727;
    --primary: #2563eb; /* Blanco y Negro */
    --text-main: #ffffff;
       --logo-filter: brightness(1); 
       --search-border: #ffffff;
}

body.theme-carbon {
    --bg: #1a1a1a;
    --card-bg: #2d2d2d;
    --primary: #f59e0b; /* Naranja tipo Caterpillar/Construction */
    --text-main: #e5e7eb;
       --logo-filter: brightness(1); 
      --search-border: #f59e0b;
}

body.theme-classic {
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --primary: #2563eb;
    --text-main: #0f172a;
    --text-dim: #64748b;
    --logo-filter: brightness(0) opacity(0.5); /* Esto los vuelve negros */
    --search-text: #1b1b1b;
    --search-placeholder: #a5a5a5;
    --search-border: #2563eb;

--bot-msg-bg: #2563eb; /* Burbuja blanca */
    --bot-msg-text: #faf8f8; /* Texto negro */

    --user-msg-bg: #262626; /* Gris muy oscuro */
    --user-msg-text: #ffffff;
 --step-bg: #fafafa;


--funnel-overlay-bg: rgba(241, 245, 249, 0.95);
    --funnel-card-border: #2563eb;
    --funnel-shadow: rgba(0, 0, 0, 0.1);

    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --input-placeholder: #94a3b8;

    --text-main2: #131313;
--stripe-bg: #f8fafc;
    --stripe-border: #cbd5e1;
  --text-main3: #131212;

}
/* Tema Default/Midnight: Logos BLANCOS */
:root {
    /* ... tus otras variables ... */
    --logo-filter: brightness(0) invert(1); /* Esto los vuelve blancos */
    --search-text: #ffffff;
    --search-placeholder: #94a3b8;
      --search-border: #334155;

      --bot-msg-bg: #2563eb; /* Azul original */
    --bot-msg-text: #ffffff;

    --user-msg-bg: #334155; /* Gris azulado oscuro */
    --user-msg-text: #ffffff;
    --step-bg: #1e293b;

    --funnel-overlay-bg: rgba(15, 23, 42, 0.95);
    --funnel-card-border: #3b82f6;
    --funnel-shadow: rgba(59, 130, 246, 0.5);

    --input-bg: #0f172a;
    --input-border: #334155;
    --input-placeholder: #475569;
   --text-main2: #131313;
 --text-main3: #f0eeee;
   --stripe-bg: #f3f3f3;
    --stripe-border: #334155;
}

/* Tema Carbon: Logos NARANJAS (opcional, para combinar con el tema) */
body.theme-carbon {
    /* ... tus otras variables ... */
   /* --logo-filter: brightness(1) sepia(1) hue-rotate(15deg) saturate(5);*/
    --logo-filter: brightness(1);
}
/* Burbuja de "Escribiendo..." */
.typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 15px;
    background: var(--primary);
    border-radius: 15px;
    width: fit-content;
    align-self: flex-start;
    margin-bottom: 10px;
}

.typing span {
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing span:nth-child(1) { animation-delay: -0.32s; }
.typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.voice-control {
    display: flex;
    align-items: center;      /* Centra verticalmente */
    justify-content: center; /* ESTA ES LA CLAVE: Centra horizontalmente */
    gap: 8px;
    background: rgba(37, 99, 235, 0.15);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(37, 99, 235, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    width: 100px;            /* Tu ancho fijo */
    margin: 10px auto;          /* Centra el contenedor mismo si su padre es un bloque */
}

.voice-control:hover {
    background: rgba(37, 99, 235, 0.25);
    transform: translateY(-1px);
}

#voice-icon-header {
    font-size: 1.1rem;
}

#voice-status-text {
    font-size: 0.75rem;
    font-weight: bold;
    color: #3b82f6;
    letter-spacing: 0.5px;
}

/* Estilo cuando está apagado */
.voice-control.voice-off {
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.3);
}

.voice-control.voice-off #voice-status-text {
    color: #94a3b8;
}
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
}

.toast-msg {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    color: #f8fafc;
    padding: 16px 24px;
    border-radius: 12px;
    border-left: 4px solid #ef4444; /* Rojo para error */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: sans-serif;
    animation: slideIn 0.3s ease-out forwards;
}

.toast-msg.success { border-left-color: #22c55e; } /* Verde para éxito */

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    to { transform: translateX(20px); opacity: 0; }
}