:root {
    /* Colores */
    --brand-red: #e31e3c;
    --brand-blue: #003da5;
    --brand-dark: #1a1a1a;
    --bg-light: #f8fafc;
    --white: #ffffff;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --success: #10b981;
    --error: #ef4444;

    /* Bordes tipo Tailwind */
    --border: 1px solid var(--gray-300);
    --border-2: 2px solid var(--gray-300);
    --border-blue: 2px solid var(--brand-blue);
    --border-red: 2px solid var(--brand-red);
    --border-success: 2px solid var(--success);

    /* Espaciado compacto */
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px -5px rgba(0, 61, 165, 0.1);
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-light);
    color: var(--brand-dark);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 16px 12px;
    -webkit-font-smoothing: antialiased;
    line-height: 1.4;
}

.container {
    width: 100%;
    max-width: 420px;
    margin-top: 5px;
}



/* --- Header en una sola línea --- */
.brand-header {
    display: flex;
    /* Activa la alineación horizontal */
    align-items: center;
    /* Centra verticalmente logo y texto */
    justify-content: center;
    /* Centra todo el bloque en la pantalla */
    gap: 16px;
    /* Espacio entre el logo y el texto */
    margin-bottom: 18px;
    text-align: left;
    /* Alinea el texto a la izquierda */
}

.logo-circle {
    width: 56px;
    /* Tamaño ajustado para verse bien en línea */
    height: 56px;
    background: white;
    border-radius: 50%;
    margin: 0;
    /* Quitamos el margin auto que tenía antes */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    border: 3px solid white;
    position: relative;
    flex-shrink: 0;
    /* Evita que el logo se aplaste */
}

.logo-circle::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(45deg, var(--brand-blue), var(--brand-red));
    border-radius: 50%;
    z-index: -1;
}

.logo-circle img {
    width: 65%;
    height: 65%;
    object-fit: contain;
}

.header-content h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--brand-blue);
    margin: 0;
    line-height: 1.1;
}

.header-content .subtitle {
    font-size: 13px;
    color: var(--gray-600);
    margin-top: 2px;
    font-weight: 500;
}




/* --- Tarjetas Compactas --- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    border: var(--border);
    transition: var(--transition);
}

.card-header {
    margin-bottom: 16px;
}

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--brand-dark);
    display: flex;
    align-items: center;
    gap: 7px;
}


/* --- Inputs Compactos tipo Tailwind --- */
.input-group {
    margin-bottom: 16px;
}

.label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
    font-size: 18px;
    pointer-events: none;
    transition: var(--transition);
}

input, select {
    width: 100%;
    padding: 10px 11px 11px 50px;
    font-size: 14px;
    font-weight: 500;
    color: var(--brand-dark);
    background: var(--white);
    border: var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: var(--transition);
    appearance: none; /* Importante para quitar la flecha por defecto del navegador */
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Estados de los inputs */
input:focus {
    border: var(--border-blue);
    box-shadow: 0 0 0 3px rgba(0, 61, 165, 0.1);
}

input.success {
    border: var(--border-success);
}

input.error {
    border: 1px solid var(--error);
}

input:focus+.input-icon {
    color: var(--brand-blue);
}

/* --- Botones Compactos --- */
.btn {
    width: 100%;
    padding: 11px 15px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--brand-red);
    color: white;
}

.btn-primary:hover {
    background: #c21830;
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border: var(--border);
    margin-top: 8px;
}

.btn-secondary:hover {
    border-color: var(--brand-blue);
    color: var(--brand-blue);
}

.btn-whatsapp {
    background: #25D366;
    color: white;
}

.btn-whatsapp:hover {
    background: #128C7E;
}

/* --- Grid Compacto --- */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* --- Badge de Agente Compacto --- */
.agent-badge {
    background: linear-gradient(135deg, var(--brand-blue) 0%, #1e3a8a 100%);
    border-radius: var(--radius-sm);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    margin-bottom: 20px;
    border: var(--border);
    border-color: rgba(255, 255, 255, 0.2);
}

.badge-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.badge-info h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

/* Nuevo estilo sutil para el Nivel */
.badge-pill {
    display: inline-block;
    background: rgba(0, 0, 0, 0.2); /* Fondo oscuro semitransparente */
    border: 1px solid rgba(255, 255, 255, 0.3); /* Borde fino y sutil */
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 500; /* Menos negrita */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.8); /* Blanco un poco apagado */
    margin-top: 6px; /* Un poco de aire arriba */
    align-self: flex-start; /* Asegura que se alinee a la izquierda */
}

/* --- Divisores y Secciones --- */
.divider {
    display: flex;
    align-items: center;
    margin: 20px 0 12px;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: var(--gray-300);
}

.divider-text {
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 10px;
}

.section-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-dark);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* --- Vista de Éxito Compacta --- */
.success-content {
    text-align: center;
    padding: 20px;
}

.icon-check {
    font-size: 48px;
    color: var(--success);
    margin-bottom: 16px;
}

.success-content h2 {
    color: var(--brand-blue);
    margin-bottom: 8px;
    font-size: 18px;
    font-weight: 700;
}

.success-content p {
    color: var(--gray-600);
    font-size: 13px;
    margin-bottom: 20px;
}

.summary-box {
    background: var(--gray-100);
    border: var(--border);
    border-radius: var(--radius-sm);
    padding: 15px;
    margin: 15px 0;
    text-align: left;
    font-family: 'Poppins', monospace;
    font-size: 12px;
    color: var(--gray-800);
    line-height: 1.5;
    white-space: pre-line;
    max-height: 220px;
    overflow-y: auto;
}

/* --- Toast Compacta --- */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--gray-800);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 3000;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 90%;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.error {
    background: var(--error);
}

.toast.success {
    background: var(--success);
}

/* --- MODAL CONFIRMACIÓN (Estilo DeepSeek) --- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius);
    width: 90%;
    max-width: 360px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s var(--transition);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--bg-light);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--brand-blue);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-500);
    padding: 4px;
}

.modal-body {
    padding: 20px;
    font-size: 13px;
    color: var(--gray-700);
    line-height: 1.6;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 12px;
    background: var(--white);
}

.preview-list p {
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
}

.preview-list strong {
    color: var(--brand-dark);
}

/* --- Animaciones --- */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hidden {
    display: none !important;
}

/* Loader Compacto */
.loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Compacto */
@media (max-width: 480px) {
    .container {
        margin-top: 4px;
    }

    .card {
        padding: 16px;
    }

    .grid-2 {
        gap: 10px;
    }

    .agent-badge {
        padding: 12px;
    }

    input {
        padding: 10px 10px 10px 36px;
    }

    .btn {
        padding: 10px 14px;
    }
}

@media (max-width: 360px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .brand-header h1 {
        font-size: 18px;
    }
}

/* Estilo base para el mensaje de feedback */
#msgFeedback {
    margin: 10px 0 20px 0; /* Espacio arriba y abajo */
    padding: 15px;
    border-radius: 12px; /* Bordes redondeados */
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    border: 1px solid transparent; /* Preparamos el borde */
    line-height: 1.4;
    display: block;
    
    /* Animación para que aparezca con un pequeño "pop" */
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}